小编use*_*255的帖子

使用多个数据库时,Grails 2无法使用spring security登录

在Grails的2.0.3,我安装了Spring Security的核心,并创建了用户,并的UserRole角色对象按教程:http://blog.springsource.org/2010/08/11/simplified-spring-security-with-grails /

一切顺利,直到我决定添加第二个数据源以准备从其他数据库访问对象.DataSource.groovy看起来像这样:

test {
    dataSource_product {
        dbCreate = "update"
        url = "jdbc:mysql://localhost/products"
        pooled = true
        driverClassName = "com.mysql.jdbc.Driver"
        username = "blah"
        password = "blah"
        loggingSql = true
        dialect = 'org.hibernate.dialect.MySQL5InnoDBDialect'
    }
    dataSource {
        dbCreate = "update"
        url = "jdbc:mysql://localhost/core"
        pooled = true
        driverClassName = "com.mysql.jdbc.Driver"
        username = "blah"
        password = "blah"
        loggingSql = true
        dialect = 'org.hibernate.dialect.MySQL5InnoDBDialect'
    }
}
Run Code Online (Sandbox Code Playgroud)

现在我无法登录 - 即使我所做的只是添加datasource_product.如果我对此进行评论并重新创建用户(在Bootstrap.groovy中),那么我可以再次登录.Bootstrap.groovy包含:

def init =
{ servletContext ->

    // Add in roles
    Role.withTransaction { 
        def adminRole = …
Run Code Online (Sandbox Code Playgroud)

spring-security multiple-databases grails-2.0

3
推荐指数
1
解决办法
1762
查看次数