我的application.yml文件中有以下健康管理终结点
management:
endpoints:
health:
sensitive: false
web:
base-path: /我有一个拦截器,它的代码如下
class TestInterceptor {
TestInterceptor() {
matchAll()
}
boolean before() {
if (request.forwardURI?.endsWith('.json')) {
// ... some code
return false
}
true
}
}效果很好。应用程序正在运行于8080上。
但一更改管理端点的端口(以便在另一个端口上提供健康检查),下面的代码如下
management:
server:
port: 8989
endpoints:
health:
sensitive: false
web:
base-path: /然后,应用程序在访问拦截器中的请求对象时抛出一个强制转换异常。
org.springframework.web.util.NestedServletException:请求处理失败;嵌套的异常是org.codehaus.groovy.runtime.typehandling.GroovyCastException:不能强制转换对象的请求(GET//localhost:8989/testApp/
)@68117e64‘,类'org.springframework.web.context.request.ServletRequestAttributes’到类'org.grails.web.servlet.mvc.GrailsWebRequest‘
任何解决问题的建议。
(Grails 4.0.12、Groovy 2.5.14和Java 11)
发布于 2022-01-08 10:00:07
升级到Grails 5,上面的功能可以正常工作。
https://stackoverflow.com/questions/69617053
复制相似问题