我正在尝试使用此视频示例(小心,俄语语音)编写 REST 服务器。在示例中,当讲师在控制器类上方编写 @RequestMapping 时,类将被使用。但在我的情况下,控制器类“从未使用过”,当我用我的控制器启动 tomcat 服务器并进入页面http://localhost:8000/app/remind/get 时,我收到这个错误:没有映射 GET /应用程序/提醒/获取
这是我的控制器代码:
@Controller
@RequestMapping("/reminder")
public class ReminderController {
@RequestMapping(value = "/get", method = RequestMethod.GET)
@ResponseBody
public String getReminder(){
return "my reminder";
}
}
这是我的 WebConfig.java
@Configuration
@EnableWebMvc
@ComponentScan("com.fillooow.remindme.server")
public class WebConfig extends WebMvcConfigurerAdapter {
}
那么,你能解释一下,为什么我的课程“从未使用过”,我错过了什么?
编辑 我的问题是配置文件中的错误上下文(“/”而不是“/app”)
富国沪深
慕运维8079593
相关分类