具有多个源路径(servlet)的Springboot平针织物

时间:2016-12-24 10:33:07

标签: java spring-boot jersey-2.0 embedded-tomcat-8

我开始在我的应用程序中使用Springboot。我的web.xml看起来像这样

    <servlet>
        <servlet-name>Internal Tools</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>in.playment.internal.api;in.playment.auditor.api</param-value>
        </init-param>
        <init-param>
            <param-name>jersey.config.server.provider.classnames</param-name>
            <param-value>org.glassfish.jersey.filter.LoggingFilter;org.glassfish.jersey.media.multipart.MultiPartFeature;in.playment.gateway.RequestFilter;in.playment.gateway.ResponseFilter;in.playment.gateway.DebugExceptionMapper;in.playment.gateway.security.Binder</param-value>
        </init-param>

        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Internal Tools</servlet-name>
        <url-pattern>/v0/internal/*</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>External Apis</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>in.playment.rutherford.api;in.playment.payment.api;in.playment.payment.resource</param-value>
        </init-param>
        <init-param>
            <param-name>jersey.config.server.provider.classnames</param-name>
            <param-value>org.glassfish.jersey.filter.LoggingFilter;org.glassfish.jersey.media.multipart.MultiPartFeature;in.playment.gateway.RequestFilter;in.playment.gateway.ResponseFilter;in.playment.gateway.DebugExceptionMapper;in.playment.gateway.security.Binder;in.playment.payment.exception.PaymentExceptionMapper</param-value>
        </init-param>

        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>External Apis</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>

我想为网址使用两个不同的基本路径。我有不同的包和不同的异常映射器。我怎样才能在Springboot嵌入式tomcat中实现这一点。到目前为止,我只能实现其中一个。如果我尝试做两个注册表,它会抛出异常org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.glassfish.jersey.server.ResourceConfig' available: expected single matching bean but found 2: jerseyConfig,getResourceConfig

0 个答案:

没有答案