【问题标题】:Spring boot addInterceptors not being called in Websphere application server在 Websphere 应用程序服务器中未调用 Spring Boot addInterceptors
【发布时间】:2017-04-05 19:59:08
【问题描述】:

我有一个使用 SpringWS 的 Spring Boot 应用程序。在 WsConfigurerAdapter 内部,我重写 addInterceptors 以添加日志记录/身份验证/验证/等。

@Configuration
@EnableCaching
@EnableWs
public class WebServiceConfig extends WsConfigurerAdapter {

    ...

    @Override
    public void addInterceptors(List<EndpointInterceptor> interceptors) {
        EnvironmentSettings environment = getEnvironmentSettings();

        interceptors.add(getLogSetupInterceptor());
        interceptors.add(getAuthenticationInterceptor());
        interceptors.add(getServerLoggingInterceptor());
        interceptors.add(getAuthorizationInterceptor());
        ServerPayloadValidatingInterceptor validatingInterceptor = new ServerPayloadValidatingInterceptor();
        validatingInterceptor.setValidateRequest(environment.isValidateSoapRequest());
        validatingInterceptor.setValidateResponse(environment.isValidateSoapResponse());
        validatingInterceptor.setXsdSchema( xsdSchema());
        interceptors.add(validatingInterceptor);
    }
}

奇怪的是,当在本地运行时,所有这些拦截器都被添加并为每个请求运行就好了。但是,当我将应用程序作为 .war 部署到 WAS 时,这种方法没有运行。我什至添加了日志语句,我可以说是这个方法被跳过了,而不是拦截器本身。有人知道我不知道的关于 spring boot .war 文件的信息吗?

另外,这是我的应用程序类:

@SpringBootApplication
public class Application extends SpringBootServletInitializer  {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }


    public static void main(String[] args) {

        SpringApplication.run(Application.class, args);

    }

}

【问题讨论】:

    标签: java spring websphere


    【解决方案1】:

    我知道我做错了什么。事实证明,我在 /* 的 WebServiceConfig 和 web.xml 中都创建了一个 servlet 映射。

    【讨论】:

      猜你喜欢
      • 2016-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-18
      • 1970-01-01
      • 1970-01-01
      • 2015-11-30
      • 2019-08-06
      相关资源
      最近更新 更多