我想将用户和密码的数据保存在servelt中 我不想创建表user和user_role但是在diffrerent类中执行此逻辑是否可能? 也许在dataSource中写入DB名称?
spring-security.xml
<authentication-provider>
<password-encoder ref="encoder" />
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select username,password, enabled from users where username=?"
authorities-by-username-query="select username, role from user_roles where username =?" />
</authentication-provider>
</authentication-manager>
答案 0 :(得分:1)
在配置中注入:
<authentication-manager>
<authentication-provider user-service-ref='myUserDetailsService'/>
</authentication-manager>