Java 未找到JAX-RS的处理程序方法

Java 未找到JAX-RS的处理程序方法,java,spring,rest,spring-boot,Java,Spring,Rest,Spring Boot,我有一个JAX-RS资源 @Path("/profile") public class ProfileResource { @GET @Path(value = "/{username}") public Response getProfile( @PathParam("username") String username, @Context UriInfo uriInfo ) throws URISyntaxEx

我有一个JAX-RS资源

@Path("/profile")
public class ProfileResource {

    @GET
    @Path(value = "/{username}")
    public Response getProfile(
            @PathParam("username") String username,
            @Context UriInfo uriInfo
    ) throws URISyntaxException {
       ....
    }
}



    2017-07-29 20:37:41.940 DEBUG 4004 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Successfully completed request
2017-07-29 20:38:01.223 DEBUG 4004 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/profile/jonki]
2017-07-29 20:38:01.236 DEBUG 4004 --- [nio-8080-exec-7] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /profile/jonki
2017-07-29 20:38:01.236 DEBUG 4004 --- [nio-8080-exec-7] s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/profile/jonki]
2017-07-29 20:38:01.237 DEBUG 4004 --- [nio-8080-exec-7] o.s.w.s.handler.SimpleUrlHandlerMapping  : Matching patterns for request [/profile/jonki] are [/**]
2017-07-29 20:38:01.237 DEBUG 4004 --- [nio-8080-exec-7] o.s.w.s.handler.SimpleUrlHandlerMapping  : URI Template variables for request [/profile/jonki] are {}
2017-07-29 20:38:01.237 DEBUG 4004 --- [nio-8080-exec-7] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapping [/profile/jonki] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@36463b09]]] and 1 interceptor
2017-07-29 20:38:01.237 DEBUG 4004 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : Last-Modified value for [/profile/jonki] is: -1
2017-07-29 20:38:01.238 DEBUG 4004 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2017-07-29 20:38:01.238 DEBUG 4004 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : Successfully completed request
2017-07-29 20:38:01.238 DEBUG 4004 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/error]
2017-07-29 20:38:01.239 DEBUG 4004 --- [nio-8080-exec-7] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /error

我没有找到JAX-RS的方法。我使用的是Spring Boot,还没有进行任何配置。

您无缘无故地混淆了技术。Spring有自己的web框架,不需要JAX-RS,SpringWeb也不兼容JAX-RS,这就解释了为什么处理程序没有注册。看见可以将JAX-RS与Spring依赖项注入一起使用,但这是不必要的。请参阅。

您是否在spring boot中配置了jaxrs以在ProfileResource包中查找rest资源,或者至少专门注册了您的类


我建议您阅读有关该问题的spring boot文档第27.2节看起来您在发布问题,但没有将任何答案标记为已接受。这是确保你的问题被忽略的好方法。我不喜欢这个答案中的假设。@sscrass你不必这么做。