是否真的不可能使用PostgreSQL的Spring Security默认模式,因为部分"varchar_ignorecase" does not exist
无法替换?
我只是测试默认设置:
auth.jdbcAuthentication()
.dataSource(dataSource)
.withDefaultSchema();
以下是错误:
引起: org.springframework.beans.factory.BeanDefinitionStoreException:工厂方法[public javax.servlet.Filter org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain()throws java.lang.Exception]引发异常;
嵌套异常是 org.springframework.jdbc.datasource.init.ScriptStatementFailedException:无法在资源类路径资源的第1行执行SQL脚本语句 [org / springframework / security / core / userdetails / jdbc / users.ddl]:create table users(username varchar_ignorecase(50)not null primary key,password varchar_ignorecase(500)not null,enabled boolean not null);
嵌套异常是 org.postgresql.util.PSQLException:错误:类型“varchar_ignorecase”不存在
因为默认架构不适合PostgreSQL,我需要创建自己的架构并为用户和权限查询实现自己的查询。
auth.jdbcAuthentication()
.dataSource(dataSource)
.usersByUsernameQuery(
"select username,password, enabled from users where username=?")
.authoritiesByUsernameQuery(
"select username, role from user_roles where username=?");