我在一段时间前完成了此工作,但在1.3中进行的设置与在1.2中进行的设置不同。我发现只能通过将外部XML文件添加到web.xml中的contextConfigLocation
context-param中来访问它们:
<context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/applicationContext.xml /WEB-INF/applicationContext-security.xml </param-value></context-param>
除此之外,该配置与非Grails应用程序的配置相同。您可能还需要配置jar。
另外,不要将jar复制到您的lib目录中,而应使用BuildConfig.groovy中的IVy配置,这样您的计算机上每个jar都只有一个副本。这是应该工作的一种:
grails.project.class.dir = 'target/classes'grails.project.test.class.dir = 'target/test-classes'grails.project.test.reports.dir = 'target/test-reports'grails.project.dependency.resolution = { inherits 'global' log 'warn' repositories { grailsPlugins() grailsHome() grailsCentral() ebr() // SpringSource http://www.springsource.com/repository } dependencies { runtime('org.springframework.security:org.springframework.security.core:3.0.3.RELEASE') { excludes 'com.springsource.org.aopalliance', 'com.springsource.org.apache.commons.logging', 'org.springframework.beans', 'org.springframework.context', 'org.springframework.core' } runtime('org.springframework.security:org.springframework.security.config:3.0.3.RELEASE') runtime('org.springframework.security:org.springframework.security.web:3.0.3.RELEASE') { excludes 'com.springsource.javax.servlet', 'com.springsource.org.aopalliance', 'com.springsource.org.apache.commons.logging', 'org.springframework.aop', 'org.springframework.beans', 'org.springframework.context', 'org.springframework.core', 'org.springframework.web' } }}


