Cannot access some controllers in a Spring Boot and Jersey application

后端 未结 1 763
慢半拍i
慢半拍i 2021-01-28 06:21

I have a small problem to access some controllers. When I send a request to /, I a get an HTTP 404, and the same for the movies path.

p         


        
相关标签:
1条回答
  • 2021-01-28 06:57

    Try to change your controller annotations to something like this:

    @Controller
    @RequestMapping(value="/movies", produces="application/json)
    public class MovieController{
    
        @RequestMapping(value="/", method=RequestMethod.GET)
        public MyResponseObject getMovies(){
            //you can return a POJO object if you are using a Jackson Mapper
            return new MyResponseObject("foo", "bar");
        }
    
    }
    
    0 讨论(0)
提交回复
热议问题