带Jboss eap 6.4的Spring boot 2.0.1

带Jboss eap 6.4的Spring boot 2.0.1,spring,spring-boot,jboss,Spring,Spring Boot,Jboss,是否有人将SpringBoot2.0.1(带starter)生成的war部署到JBossEAP6.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.deployme

是否有人将SpringBoot2.0.1(带starter)生成的war部署到JBossEAP6.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;
    }

}
package com.me.app.deployment.webapp;
导入com.me.app.AppSpringConfiguration;
导入org.springframework.beans.factory.ObjectProvider;
导入org.springframework.boot.SpringApplication;
导入org.springframework.boot.autoconfigure.springboot应用程序;
导入org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
导入org.springframework.boot.autoconfigure.web.servlet.DispatcherServletRegistrationBean;
导入org.springframework.boot.builder.SpringApplicationBuilder;
导入org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
导入org.springframework.context.annotation.Bean;
导入org.springframework.context.annotation.import;
导入org.springframework.context.annotation.PropertySource;
导入org.springframework.web.servlet.DispatcherServlet;
导入javax.servlet.MultipartConfigElement;
导入javax.servlet.ServletContext;
导入javax.servlet.ServletException;
导入静态java.util.Collections.emptySet;
@SpringBootApplication(排除={
SecurityAutoConfiguration.class
})
@PropertySource(value=“file:/some/path/some.properties”,ignoreResourceNotFound=true)
@导入({AppSpringConfiguration.class})
公共类WebAppRunner扩展了SpringBootServletInitializer{
公共静态void main(字符串[]args){
run(WebAppRunner.class,args);
}
@凌驾
启动时公共void(ServletContext ServletContext)引发ServletException{
setSessionTrackingModes(emptySet());
super.onStartup(servletContext);
}
@凌驾
受保护的SpringApplicationBuilder配置(SpringApplicationBuilder应用程序){
返回application.sources(getClass());
}
@豆子
公共dispatcherServletRegistration bean dispatcherServletRegistration(
DispatcherServlet DispatcherServlet,
对象提供程序(multipartConfig){
DispatcherServletRegistrationBean注册=新DispatcherServletRegistrationBean(
dispatcherServlet,“/*”;
注册.setName(“dispatcherServlet”);
注册。setLoadOnStartup(-1);
multipartConfig.ifAvailable(注册::setMultipartConfig);
申报登记;
}
}
然后在/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>


spring链接说:“您还可以将spring引导应用程序部署到任何Servlet 3.0+兼容的容器中。”所以您可以。没错,我忽略了文档中的陈述。但是,您只能使用SpringMVC(servlet)堆栈,而不能使用SpringWebFlux(反应式)堆栈。面对同样的问题,您是否已经进入了这个阶段?我认为,通过删除SpringBootStarterWeb对JEE的依赖,它来自SpringMVC的Bean验证。但在此之后,我们可能无法使用RESTAPI之类的功能