My application uses Spring auto-wiring to configure the beans. I have just tried adding @Transactional and the expected proxies do not seem to be called. I want the Personal
Define an interface for UpdatePublicMapService, and use that interface under the @Autowired annotation in your controller. Leave the @Transactionnal annotation in the UpdatePublicMapService class implementation, and Spring should deal just fine with your autowired transactionnal object.
I worked it out. Spring loads two application contexts and the way it loaded resulted in two UpdatePublicMapServices being loaded.
The ContextLoaderListener loads a root application context. In my case, it found and loaded the UpdatePublicMapService with the transaction wrapper.
Then the DispatcherServlet loads and reads <name>-servlet.xml
. In my case, it used to contain <context:component-scan base-package="com.th"/>
which scanned for and loaded UpdatePublicMapService again - but without the transaction wrapper.
The fix was to trim the component scan configuration to only hit the things I wanted loaded in the servlet and not the root application context.
I had similar problem but another solution. In my code, there was BeanFactoryHelper.getBean(...) used. If you use this class, you need to call method use() before and release() after.