在Jboss EAP上的springBoot应用程序,servlet上下文没有lodaed

May*_*urb 8 maven-3 jboss-eap-6 spring-boot

我有一个非常简单的Spring启动应用程序,我想部署到Jboss EAP.这是我的简单应用程序类:

@SpringBootApplication

public class MayurApplication extends SpringBootServletInitializer{

    public static void main(String[] args) {
        SpringApplication.run(MayurApplication.class, args);
    }

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

    private static Class<MayurApplication> applicationClass = MayurApplication.class;
}

@RestController
class GreetingController {

    @RequestMapping("/hello/{name}")
    String hello(@PathVariable String name) {
        return "Hello, " + name + "!";
    }
}
Run Code Online (Sandbox Code Playgroud)

而我的pom.xml也非常基础.当我在Tomcat上运行这个应用程序时,使用带有spring boot的嵌入式Tomcat.只需点击一下,一切都像魅力一样.我可以访问http://localhost:8080/demo/hello/World它也有效.

现在我试图让它与Jboss EAP兼容战争,我通过从spring-boot-starter-web中排除来禁用Tomcat,并将其转换为war项目.(根据文章http://spring.io/blog/2014/03/07/deploying-spring-boot-applications的建议).

我还补充说:

<dependency>
                  <groupId>javax.servlet</groupId>
                  <artifactId>javax.servlet-api</artifactId>
                 <scope>provided</scope>
            </dependency>,
Run Code Online (Sandbox Code Playgroud)

因为它在抱怨.

在所有这一切之后,它编译得很好并且也创造了一场战争.当我将此战争复制到jboss部署时,我可以看到它在控制台上成功部署.但其余的api http://localhost:8080/demo/hello/World只是不起作用,并不断在浏览器上抛出错误:

JBWEB000068: message /demo/hello/World
JBWEB000069: description JBWEB000124: The requested resource is not available.
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

You*_*dib 18

Spring Boot Reference Guide中找到了这个,在application.properties文件中添加以下行

server.servlet-path=/*
Run Code Online (Sandbox Code Playgroud)

在jBoss EAP 6.2中对此进行了测试并且运行良好.


May*_*urb 6

答案在这里: Spring Java Config vs Jboss 7

显然"/"不适用于Jboss EAP 6.3,但"/*"有效.他们似乎已经用wildfly 8修了它