[英]Spring boot MVC application JSPs not rendering in jboss-eap-6.4
[英]Spring boot 2.0.1 with Jboss eap 6.4
有没有人将Spring boot 2.0.1(带启动器)生成的战争部署到Jboss EAP 6.4?
我试着做一些调整,但没有成功。
有没有在这里发光?
谢谢!
您只能将Spring Boot 2.x应用程序部署到任何Servlet 3.1+兼容容器,而JBOSS EAP 6.x仅支持Servlet 3.0 。
您必须将spring boot降级到1.5.x或将JBOSS升级到7+
以下是对文档的引用
我通过遵循建议获得了成功,参见示例:
package com.me.app.deployment.webapp;
import com.me.app.AppSpringConfiguration;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletRegistrationBean;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.servlet.DispatcherServlet;
import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import static java.util.Collections.emptySet;
@SpringBootApplication(exclude = {
SecurityAutoConfiguration.class
})
@PropertySource(value = "file:/some/path/some.properties", ignoreResourceNotFound = true)
@Import({AppSpringConfiguration.class})
public class WebAppRunner extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(WebAppRunner.class, args);
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
servletContext.setSessionTrackingModes(emptySet());
super.onStartup(servletContext);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(getClass());
}
@Bean
public DispatcherServletRegistrationBean dispatcherServletRegistration(
DispatcherServlet dispatcherServlet,
ObjectProvider<MultipartConfigElement> multipartConfig) {
DispatcherServletRegistrationBean registration = new DispatcherServletRegistrationBean(
dispatcherServlet, "/*");
registration.setName("dispatcherServlet");
registration.setLoadOnStartup(-1);
multipartConfig.ifAvailable(registration::setMultipartConfig);
return registration;
}
}
然后在/webapp/WEB-INF/jboss-deployment-structure.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="javax.validation"/>
<module name="javax.validation.api"/>
<module name="org.hibernate"/>
<module name="org.hibernate.validator"/>
<module name="javaee.api"/>
<module name="javax.faces.api"/>
<module name="org.jboss.as.connector"/>
<module name="org.jboss.as.ee"/>
<module name="org.jboss.ironjacamar.impl"/>
<module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider"/>
<module name="org.jboss.weld.core"/>
<module name="org.jboss.weld.spi"/>
</exclusions>
<dependencies>
<module name="com.me.deps"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.