java - How to inject spring injection manually if not done automatically -
My spring dependency is working fine but there is a square
but my spring injection I'm not working here because it applies class Why have I asked the question to ask, but no one has given me the answer, so I decided to use the DAO with the new operator But that depends on the session factory, which is a spring bean, in exchange for Configure ("Com / Voices / Services / Hibernate Cfg .xml") .buildSessionFactory (); But again I have many beans in the hibernate context, such as data sources, property files, and I am finding it very difficult to rewrite all the things. Can I manually inject the You can take a look at the Spring Java configuration. The examples below all dependencies of Userdoes will be automatically set to spring. This should be something like this: CustomUserDetaisls To match the username and password
@Autowired Private UserDAO userDAO
userDetailsSerivce Although injection works if I pulled out the tools.
Personal Usageo Userdao = New user ();
UserDo .
userDAO in any way so that all related spring injection sessions practice work
@configuration @ Property Soros ("Classpath: Configuration. Properties") Public class ApplicationConfig {@ Ben Public Username user ()) Return new user (); } @ Beynes Public Control User Custom User Details (UserUserDio) {Custom User Display Custom UserDayfiles = New Custom User Details (); CustomUserDetails.setUserDAO (userDAO ()); Return Custom User; description; }}
Comments
Post a Comment