我可以使用
从eclipse运行时让执行器工作但当我打包并将其部署到jboss 7.1作为战争时
不起作用。
我正在使用springBootVersion ='1.5.1.RELEASE'
下面给出的相关文件
引导配置和servlet初始化程序
@SpringBootApplication
@ComponentScan("com.myapp")
public class Application {
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
public class ServletInitializer extends SpringBootServletInitializer {
/*
* (non-Javadoc)
*
* @see org.springframework.boot.web.support.SpringBootServletInitializer#
* configure(org.springframework.boot.builder.SpringApplicationBuilder)
*/
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
application.child(MyExceptionMapper.class);
return application.sources(Application.class);
}
}
自定义bean加载的AppConfig类
@Configuration
@Import({
EndpointAutoConfiguration.class,
PublicMetricsAutoConfiguration.class,
HealthIndicatorAutoConfiguration.class })
public class AppConfig { beans...}
Application.properties
logging.level.org.springframework=WARN
endpoints.enabled=false
endpoints.health.enabled=true
应用程序的上下文路径是使用jboss-web.xml
设置的<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/apps/myapp</context-root>
</jboss-web>
的JBoss部署-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
</exclude-subsystems>
<dependencies>
<!-- Exclude JAX-RS: 2. re-import the javaee.api and exclude the JAX-RS
classes -->
<module name="javaee.api">
<imports>
<exclude-set>
<path name="javax/ws/rs" />
<path name="javax/ws/rs/core" />
<path name="javax/ws/rs/ext" />
<path name="javax/validation" />
<path name="javax/validation/bootstrap" />
<path name="javax/validation/constraints" />
<path name="javax/validation/groups" />
<path name="javax/validation/metadata" />
<path name="javax/validation/spi" />
</exclude-set>
</imports>
</module>
</dependencies>
<exclusions>
<module name="javaee.api" />
<module name="javax.validation.api" />
<module name="javax.faces.api" />
<module name="org.hibernate.validator" />
</exclusions>
</deployment>
</jboss-deployment-structure>
任何帮助将不胜感激。提前致谢