【问题标题】:Grails file resources.groovy ignored by Spring Tool SuiteGrails 文件 resources.groovy 被 Spring Tool Suite 忽略
【发布时间】:2016-03-09 14:11:21
【问题描述】:

最新版本的 STS(例如 3.7.3)不再支持 Grails,因此我使用 STS Gradle 项目作为解决方法,以便使用“Spring Boot App”选项运行我的 Grails 应用程序。它工作得很好,但我遇到了以下问题:

问题:

当我通过作为“Spring Boot App”运行的 STS 执行应用程序时,不知何故,在 resources.groovy 文件下声明的所有 bean 都被忽略了。请注意,通过控制台“run-app”命令运行应用程序可以正常工作。

例外:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'facebookAuthRedirectFilter': Cannot resolve reference to bean 'redirectFailureHandlerExample' while setting bean property 'authenticationFailureHandler'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'redirectFailureHandlerExample' is defined

我的 resources.groovy 文件

package spring
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler

beans = {
    redirectFailureHandlerFacebook(SimpleUrlAuthenticationFailureHandler) {
        setDefaultFailureUrl('/login/auth')
    }
}

STS:

版本:3.7.3.RELEASE 内部版本号:201602250940 平台:Eclipse Mars.2 (4.5.2)

Grails:

Grails 版本:3.1.1 Groovy 版本:2.4.5 JVM版本:1.7.0_75

这似乎是 classpath 问题,但我还没有找到解决方法。

【问题讨论】:

    标签: grails spring-tool-suite


    【解决方案1】:

    通过更新 Groovy 编译器设置解决了这个问题。进入Window->Preferences->Groovy->Compiler,见下图:

    这样做 resources.groovy 将被编译,bean 将在运行时可用。

    【讨论】:

      猜你喜欢
      • 2015-05-14
      • 1970-01-01
      • 1970-01-01
      • 2020-09-13
      • 1970-01-01
      • 1970-01-01
      • 2014-03-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多