Micronaut 1.3.5: Page not found

十年热恋 提交于 2021-01-29 06:07:15

问题


GET http://localhost:8080/system/version

GET http://localhost:8080/system/version/

import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;

@Controller("/system")
public class SystemController {
    @Get(uri = "/version/")
    public String version() {
        return SystemController.class.getPackage().getImplementationVersion();
    }
}

leads to

{
"message": "Page Not Found",
"_links": {
    "self": {
        "href": "/system/version/",
        "templated": false
    }
}
}

How to fix this?


回答1:


If a controller method like that returns null, that will result in a 404. I expect that SystemController.class.getPackage().getImplementationVersion() is evaluating to null.



来源:https://stackoverflow.com/questions/61939066/micronaut-1-3-5-page-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!