New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@ComponentScan don't work for @Repository annotated DAOs using SessionFactory [SPR-8853] #13495
Comments
Rossen Stoyanchev commented |
Chris Beams commented Thanks, Dominik! We'll look into this. |
Chris Beams commented Hi Dominik, Everything is actually working as designed here. The problem is that you have You can either explicitly register your It's worth noting that we don't really recommend use of the Also note that Spring 3.1 RC1 includes the new |
Dominik Hirt commented Hi Cris, thank you for your recommendations. I've updated to Hibernate 4.0.0.CR6 and switched to 'native hibernate dao style'. With this new setup I run my DAO unit tests (including a Is there any workaround to proceed without waiting for 3.1RC2 ? Furthermore, you wrote, that the new LocalSessionFactoryBuilder doesn't require calling methods like afterPropertiesSet and getObject. But how can I get the sessionFactory from that builder without those methods ? |
Chris Beams commented
Use nightly snapshots. See my comment on #13419 for instructions.
Call the |
Dominik Hirt commented Hi Chris, Kind regards |
Chris Beams commented Hi Dominik, Please create a separate issue for the "No session found for current thread" issue. And yes, please reproduce this with a project under the Please add a comment to this issue mentioning the new issue so that I'm notified immediately. Please provide a link to the stackoverflow thread you mentioned as well. Thanks. |
Dominik Hirt commented Hi Chris, |
Chris Beams commented Excellent! Glad to hear. |
spring-projects-issues commentedNov 17, 2011
Dominik Hirt opened SPR-8853 and commented
If using the JavaConfig based app configuration with
@Configuration
and include the new@ComponentScan
annotation for all of my packages, the creation of the application context failed for the DAO's annotated with@Repository
which uses Hibernate/SessionFactory withIllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required.
A workaround for this error exists:
@ComponentScan
in the configuration class annotated with@Configuration
@ImportResource
in the app configuration class.I've created a reproduction project at Github (https://github.com/SpringSource/spring-framework-issues
Affects: 3.1 RC1
Reference URL: http://forum.springsource.org/showthread.php?117204-Strange-behavior-for-ComponentScan-SessionFactory-in-3.1.0RC1
Referenced from: commits spring-attic/spring-framework-issues@25b55a1, spring-attic/spring-framework-issues@dcfeff2
The text was updated successfully, but these errors were encountered: