春季启动战争不适用于EAP 6

时间:2017-10-09 06:58:14

标签: java spring-mvc spring-boot jboss

我使用spring boot创建了一个基于REST的小应用程序。该应用程序作为war包部署在EAP 6(JBoss)上。 由于EAP 6基于Java 1.7,我已经在我的maven pom中配置了编译和使用Java 1.7版本。 当我部署应用程序时,我可以在服务器日志中看到控制器正在注册,但是当我点击它时,我得到404.此外,我JBoss没有选择我的上下文根配置,而是将应用程序名称作为上下文根。我测试了所有可能的端点但是一切都给了404。 有人能告诉我一些可以帮助我继续前进的事情吗?

POM文件:

    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.7</java.version>
</properties>

...

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

应用程序配置

package com.org.orderhistory.v2.orderhistory.v2;
import ...
@SpringBootApplication
public class Application extends SpringBootServletInitializer {

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

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

}

package com.org.orderhistory.v2.orderhistory.v2.controllers;

import ...

@RestController
@RequestMapping(value="/myorder/weborders")
public class WebOrderControllers {

@RequestMapping(value="/{webUserId}",method = RequestMethod.GET, produces = "application/json")
public List<WebOrder> getWebOrdersForUser(@PathVariable Long webUserId) {

JBoss Logs

2017-10-09 02:24:29,744 [ServerService Thread Pool -- 594] INFO  [org.springframework.boot.web.servlet.FilterRegistrationBean] Mapping filter: 'requestContextFilter' to: [/*]
2017-10-09 02:24:30,368 [ServerService Thread Pool -- 594] INFO  [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter] Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5a46b924: startup date [Mon Oct 09 02:24:27 EDT 2017]; root of context hierarchy
2017-10-09 02:24:30,451 [ServerService Thread Pool -- 594] INFO  [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] Mapped "{[/org/weborders/{webUserId}],methods=[GET],produces=[application/json]}" onto public java.util.List<com.org.www.order.model.WebOrder> com.org.orderhistory.v2.orderhistory.v2.controllers.WebOrderControllers.getWebOrdersForUser(java.lang.Long)

0 个答案:

没有答案
相关问题