Prior to this commit the initially created instance was always returned. However when calling initializeBean on the BeanFactory this could lead to a proxy being returned. Ignoring the return value of this method could lead to proxies being ignored and AOP not being applied.
Now it always returns the result of the call to initializeBean which is either a proxied/wrapped instance or the original instance.
Comment From: snicoll
Thanks for the PR. Can you please add a test that exercises the use case you've described?
Comment From: mdeinum
As there wasn't a test I didn't bother to create one, but will add one.
Edit: Just noticed the auto configuration test, will add a test case there.
Comment From: mdeinum
I had a problem getting to the internals of Quartz. So I created a new test for the AutowireCapableBeanJobFactory
Comment From: mdeinum
Has been implemented with d9e72535328ff56e447a9ec69b95263da8a8495b.
Comment From: wilkinsona
Master still seems to ignore the return value: https://github.com/spring-projects/spring-boot/blob/4ede33e09bef68b54893a9898caac889de0bbfec/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/AutowireCapableBeanJobFactory.java#L45
@mdeinum the commit you’ve referenced above doesn’t seem to exist and, as far as I can tell, this would still be a good change to make. What have I missed?
Comment From: snicoll
@wilkinsona I am about to create an issue to replace this code by the one of framework.
Comment From: wilkinsona
Great, thanks. FWIW, I’m still confused about the referenced commit. I guess it’s https://github.com/spring-projects/spring-framework/commit/d9e72535328ff56e447a9ec69b95263da8a8495b but that’s a Hibernate change.
Comment From: snicoll
You are right. The proper commit is https://github.com/spring-projects/spring-framework/commit/19f33479322c17543b48d2a2ee9d68e95a3925f0