Grails - grails-spring-security-rest - 无法从 application.yml 加载 jwt secret

Grails - grails-spring-security-rest - Impossible to load jwt secret from application.yml

我正在使用 application.yml 文件加载 grails-spring-security-rest 插件的运行时配置。

grails:
    profile: angularjs
    codegen:
        defaultPackage: telja
    spring:
        transactionManagement:
            proxies: false
    gorm:
        reactor:
            # Whether to translate GORM events into Reactor events
            # Disabled by default for performance reasons
            events: false
    plugin.springsecurity:
        conf:
          rest.token.storage.jwt.secret : 'xxxxxxxxxxxxxxxxxxxxxx'

但是在启动时我收到这条消息

Configuring Spring Security REST 2.0.0.RC1... 2018-07-13 15:04:58.202 ERROR --- [ main] o.s.boot.SpringApplication : Application startup failed

java.lang.Exception: A JWT secret must be defined. Please provide a value for the config property: grails.plugin.springsecurity.conf.rest.token.storage.jwt.secret

您可以创建一个 application.groovy 和一个 runtime.groovy 来代替 yml。外部配置插件有一个从yml转换为Groovy配置的脚本: http://plugins.grails.org/plugin/grails/external-config

找到解决方案,属性 应声明为

plugin.springsecurity.rest.token.storage.jwt.secret

与日志中的内容相反

grails.plugin.springsecurity.conf.rest.token.storage.jwt.secret