如何为 micronaut 微服务设置上下文路径?我想做一些类似于 Spring Framework 中可用的操作,您可以在其中设置“server.servlet.contextPath”属性。我在这里的 micronaut 文档中找不到任何内容。我想为我的微服务和我的“bar”控制器(例如http://domain/foo/bar)设置一个基本路径。在春天,这看起来像
server:
servlet:
context-path: foo
Run Code Online (Sandbox Code Playgroud)
我目前正在使用 micronaut 1.0.0.M4。我很感激你的帮助。
小智 8
您可以在配置中设置上下文路径
micronaut:
server:
context-path: /my-path
Run Code Online (Sandbox Code Playgroud)
文档:链接
我想为我的微服务和“bar”控制器设置基本路径(例如http://domain/foo/bar)
如果您想BarController在请求发送到 时做出响应/foo/bar,到达那里的一种方法是这样的......
@Controller("/foo/bar")
public class BarController {
@Get("/")
public SomeReturnType index() {
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1856 次 |
| 最近记录: |