Grails 3.2.9,application.yml中的Spring Security

时间:2017-05-12 21:03:13

标签: grails spring-security

我试图将以下(部分)Spring Security配置从application.groovy移至application.yml

application.groovy:

grails.plugin.springsecurity.securityConfigType = 'Requestmap'
grails.plugin.springsecurity.requestMap.className = 'com.testapp.admin.Requestmap'

application.yml

springsecurity:
  securityConfigType: Requestmap
  requestMap:
    className: com.testapp.admin.Requestmap

问题是资产解析失败了application.yml中的那两行。我在auth.gsp

中运行此操作
<g:each in="${Requestmap?.list()}">
    <p>permission: ${it.configAttribute}, url: ${it.url}</p>
</g:each>

它为我提供了所有Requestmap行。因此Requestmap可用,但图形的资产分辨率等失败。如果我在application.groovy中留下这两行,资产解析就可以了。是什么给了什么?

1 个答案:

答案 0 :(得分:1)

不要忘记指定yml元素的正确层次结构:

grails: 
  plugin: 
   springsecurity:
     securityConfigType: Requestmap
     requestMap:
       className: com.testapp.admin.Requestmap