Hi,
I have to type of configuration:
1) base on annotations:
2) xml (Spring Security):Code:@Bean(destroyMethod="close") public DataSource dataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost:3306/test"); dataSource.setUsername("mysql"); dataSource.setPassword(""); return dataSource; }
Bean created in annotations configuration: dataSource is not visible for Spring Security.Code:<authentication-manager> <authentication-provider> <password-encoder hash="md5"> <salt-source user-property="username" /><!-- ref="saltSource" --> </password-encoder> <jdbc-user-service data-source-ref="dataSource" /> </authentication-provider> </authentication-manager>
What is wrong with my code?
It is look like dataSource bean is created too late.
(Every thing is ok while I am using it with JPA - before adding security)
Thanks,
Pawel
Edit:
Ok,
I've messed up with configuration.
was placed in file with configuration for org.springframework.web.servlet.DispatcherServlet.Code:<context:component-scan base-package="" />
I've moved it to correct place and everything is ok!


Reply With Quote