-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Amit Gadkari opened SPR-12773 and commented
I have @Configuration
class with @EnableAspectJAutoProxy
.
In this class I have injected
@Autowired
@Qualifier
(value="customerService")
private CustomerService customerService;
Code for CustomerService is as follows
@Service
(value="customerService")
public class CustomerServiceImpl implements CustomerService
In this customerService class I have @Transactional
method which is also present in Service Interface class
In @Configuration
class instead of proxy instance of CustomerService I get instance of customerServiceImpl. Hence transaction management is not working in application.
If I use applicationContext.getBean("customerService", CustomerService.class) and print classname name then also I am getting CustomerServiceImpl and not proxy.
I ran application 10 times
a) 7 times I got instance of customerServiceImpl
b) 3 times I got instance of proxy
My application works fine when I get instance of proxy
I think this is bug in Spring JavaConfig
Affects: 4.1.5
Attachments:
- sample-tomcat.7z (644.37 kB)
Issue Links:
- Doc: Autowiring in @Configuration classes with post-processor definitions [SPR-13285] #17875 Doc: Autowiring in
@Configuration
classes with post-processor definitions
Referenced from: commits c7fcf7c