Spring SerSecurity中的java身份验证错误
我已经为用户和管理员在Spring MVC中登录web应用创建了一个表单 我在Spring MVC中有以下配置文件:
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user1" password="12345" authorities="ROLE_USER" />
<user name="admin1" password="12345" authorities="ROLE_USER, ROLE_ADMIN" />
</user-service>
</authentication-provider>
<!-- authentication from database -->
<authentication-provider>
<jdbc-user-service data-source-ref="myDataSource"
users-by-username-query="select username,password from [Simplehr].[dbo].[USERS] where username=?"
authorities-by-username-query="Select username, concat('ROLE_',user_role) user_role from user_roles where username=?" />
</authentication-provider>
</authentication-manager>
但当我运行应用程序时,我看到登录失败的错误:
PreparedStatementCallback; bad SQL grammar [select username,password from [Simplehr].[dbo].[USERS] where username=?]; nested exception is java.sql.SQLException: Invalid column index 3.
但是,当我在SQLserver中运行SQL语句时,它是有效的
共 (0) 个答案