0

我正在使用 springboot 1.5.2,我正在使用 jersey 和 jsf

我有默认视图的映射/如下:

@Bean
    public WebMvcConfigurerAdapter defaultView() {
        return new WebMvcConfigurerAdapter() {
            @Override
            public void addViewControllers(ViewControllerRegistry registry) {
                registry.addViewController("/").setViewName("forward:/faces/public/login.xhtml");
                registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
                super.addViewControllers(registry);
            }
        };
    }

在我添加球衣配置之前,它工作正常,在我添加以下球衣配置后,它停止工作:

@Configuration
public class JerseyConfig extends ResourceConfig {
    public JerseyConfig() {
        register(MyService.class);
    }
}

当我删除 JerSeyConfig 类时,映射工作正常,但是当我添加它时,映射停止工作,请告知如何让它们一起正常工作。

4

1 回答 1

0

Could you try:

  • Annotate JerseyConfig with @Component instead of @Configuration and make sure package is being scanned via @ComponentScan in main class.

  • Make sure Spring MVC dispatcher servlet is mapped to a path different than Jersey servlet's, for instance:

    # Spring MVC dispatcher servlet path. Needs to be different than Jersey's to enable/disable Actuator endpoints access (/info, /health, ...)

    server.servlet-path: /

    # Jersey dispatcher servlet

    spring.jersey.application-path: /api

More details could be found at my blog post: Microservices using Spring Boot, Jersey, Swagger and Docker

于 2017-06-02T20:50:35.050 回答