Jersey on Spring Boot - ApplicationPath

时间:2016-01-27 21:34:05

标签: java spring spring-boot jersey

是否有更具编程性的方式,相当于以下配置:

property("jersey.config.<application.path>", api);

,设置Jersey应用程序的应用程序路径?我想让它可配置,也许可以使用类似的东西:

@ConfigurationProperties(prefix = "jersey")
public class MyResourceConfig extends ResourceConfig {

@Setter @Getter protected String api;

使用addtitinal:

@Component
public class MyRoutes extends SpringRouteBuilder {
    public void configure() throws Exception {
        from("cxf:bean:serviceV1")
                .to("direct:v1");

        from("cxf:bean:serviceV2")
                .to("direct:v2");

        from("cxf:bean:serviceCommon")
                .choice()
                    .when(header("version").isEqualTo("v1"))
                        .to("direct:v1")
                    .otherwise()
                        .to("direct:v2")
                .end();

        from("direct:v1")
                .beanRef("paymentservicev1", "buy");

        from("direct:v1")
                .beanRef("paymentservicev2", "buy");

    }
}

2 个答案:

答案 0 :(得分:4)

您可以在spring.jersey.application-path

中设置application.properties个配置

答案 1 :(得分:0)

spring.jersey.application-path = api或您的主要API路径。这将迫使球衣走向那条道路只从/ **

相关问题