我正在使用intellij
和spring-boot
来构建服务器应用程序。但它经常显示404 URI not found error
。特别是当我在课堂上宣布@RequestMapping
时。
{
"timestamp": 1519069359705,
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/profile/5"
}
@RequestMapping("/profile")
@RestController
public class ProfileController {
@Autowired
private ProfileService profileService;
@RequestMapping(name = "/{id}", method = RequestMethod.GET)
public Profile get(@PathVariable("id") int id){
return profileService.get(id);
}
}
Mapped "{[/profile],methods=[GET]}" onto public ....
注意:ProfileController
的包有多个图层。与com.company.project.modules.profiles.controller
com.company.project
包中包含Application
一样。我试过@ComponentScan
但没有帮助。同时使IDE cache
无效。
答案 0 :(得分:3)
你应该使用' value'而不是' name'在RequestMapping中:
Set propSet = properties.entrySet()
propSet.each {
def key = it.getKey()
def value = it.getValue()
env."${key}" = value
}