Grails 3 和 Spring @RequestMapping [英] Grails 3 and Spring @RequestMapping

查看:27
本文介绍了Grails 3 和 Spring @RequestMapping的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Grails 3 中,我尝试使用 spring-security-oauth,它通过@RequestMapping 提供了一些端点,我可以在 mbeans 中看到路径已配置,但任何请求总是命中 grails 并返回 404.

In Grails 3 I'm trying to use spring-security-oauth, which provides a few endpoints via the @RequestMapping I can see in the mbeans that the path is configured but any request always hits grails and returns a 404.

请求似乎从未命中 spring-security-oauth 库配置的任何端点.有没有办法确保请求到达 jar 中的端点?

The requests never seem to hit any of the endpoints configured by the spring-security-oauth lib. Is there anyway to insure the requests hit the endpoints in the jar?

推荐答案

要确保 @RequestMapping 配置的端点显示在使用 Java 配置的 Grails 3 应用程序中,您必须在 Application.groovy 中使用以下设置

To make sure the endpoints configured by @RequestMapping show in a Grails 3 app using Java config you have to use the following set up in Application.groovy

@ComponentScan("my.org.config")
class Application extends GrailsAutoConfiguration {
    static void main(String[] args) {
        GrailsApp.run(Application)
    }
}

不要以下列方式使用application.yml:

Do not use application.yml in the following way:

grails:
    profile: web
    spring:
        bean:
            packages:
                - my.org.config

虽然 bean 将被拾取,但任何带有 @RequestMapping 的东西都将无法访问.

While the beans will be picked up anything with @RequestMapping will not be accessible.

这篇关于Grails 3 和 Spring @RequestMapping的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆