1

我开始在我的应用程序中使用 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>

我想为 url 使用两个不同的基本路径。我有不同的包和不同的异常映射器。如何在 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

4

0 回答 0