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

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

问题描述

在Grails 3中,我尝试使用spring-security-oauth,它通过@RequestMapping提供了几个端点,我可以在mbeans中看到该路径已配置,但任何请求总是碰到grails并返回404。 / p>

这些请求似乎不会触及由spring-security-oauth lib配置的任何端点。无论如何要保证请求到达jar中的端点?

解决方案

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

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


请勿使用以下方式使用application.yml:

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

尽管bean将被拾取,但@RequestMapping将无法访问。


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.

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?

解决方案

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)
    }
}

Do not use application.yml in the following way:

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

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

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

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