Мое spring boot
приложение как файл jar
работает нормально. При развертывании на jboss
как war
файл jboss
регистрирует ошибку
java.lang.RuntimeException: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.
DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration':
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException:
Error creating bean with name 'spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties': Could not bind properties to 'WebMvcProperties' : prefix=spring.mvc, ignoreInvalidFields=false, ignoreUnknownFields=true;
nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.mvc.servlet' to org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties$Servlet
Я использую WebMvcConfigurer
для включения сердечников. Код;
@Bean
public WebMvcConfigurer corsConfigurer(){
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedHeaders("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowCredentials(true)
.allowedOrigins("*")
.exposedHeaders(AuthorizationController.AUTHENTICATION_KEY_NAME + "," +
HandlerHelper.REASON_HEADER_KEY_NAME,HandlerHelper.CONTENT_DISPOSITION_HEADER_KEY_NAME)
.maxAge(36000);
}
};
}
Поскольку один этот не работал (я не знаю, достаточно ли приведенного ниже кода)
@Configuration
public static class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable().headers().cacheControl().disable();
}
}