Is possible in Spring that class for bean doesn\'t have public constructor but only private ? Will this private constructor invoked when bean is created? Thanks.
Yes ! Spring can access private constructor. It will works internally like below code.
try{ Class c= Class.forName("A"); // A - className Constructor c1[]=c.getDeclaredConstructors(); c1[0].setAccessible(true); A a= (A)c1[0].newInstance(); } catch (Exception e){ e.printStackTrace(); }