So im studying for the spring core certification and i came to the issue of the @lookup method injection which makes a component class cglib proxied, yet when we get to "lite" beans, meaning @Bean on non @configuration classes i keep reading that @component classes don't extend CGLIB so that's why everytime we call the lite bean method a new instance will be created. I am missing something here?
Asked
Active
Viewed 98 times
0
-
Does this answer your question ? https://stackoverflow.com/a/51620973/4214241 – R.G Jan 17 '20 at 08:40
-
So even though you can actually get CGLIB proxies of @component classes, the Bean methods wont be, is that it? – Maxrunner Jan 17 '20 at 11:26
-
'@Configuration' proxies the method call annotated with '@Bean' . For this reason , the same instance is returned on multiple calls to the method., 'lite-mode' does not and a new instance of the bean will be returned on each call to the method. – R.G Jan 17 '20 at 11:30
-
I understand but its false saying that the reason is because @Component classes are not CGLIB proxied. – Maxrunner Jan 17 '20 at 15:51
-
Could you please share the source ? – R.G Jan 17 '20 at 16:09
-
https://www.logicbig.com/tutorials/spring-framework/spring-core/bean-definition-in-components.html Where it says: @Component classes are not CGLIB proxied. Also here : https://stackoverflow.com/a/34810476/382115 – Maxrunner Jan 17 '20 at 16:16
-
Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/206159/discussion-between-r-g-and-maxrunner). – R.G Jan 17 '20 at 16:34