我正在尝试在Wildfly 13.0.0上运行一个简单的Spring Boot应用程序,但是在尝试访问任何REST URL时总是出现404错误。
这是我的应用程序类:
package com.application.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class ExampleApp extends SpringBootServletInitializer{
public static void main(String[] args) throws Exception{
SpringApplication.run(ExampleApp.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(applicationClass);
}
private static Class<ExampleApp> applicationClass = ExampleApp.class;
}
@RestController
class HelloController {
@RequestMapping("/hello/{name}")
String hello(@PathVariable String name) {
return "Hi " + name + " !";
}
}
.war已正确部署,如果我转到localhost:8080 / application-example / index.html,但如果尝试localhost:8080 / application-example / hello或localhost:8080 / application,则可以访问创建的html索引页-example / hello / myName甚至是结尾为0.0.1 Snapshot的原始名称,我总是得到404。
当然,内部包中的RestController类也会发生这种情况,但是在上面的示例中,我们位于同一包中,因此我认为这不是可见性/扫描问题。
这是我要求的application.properties:
我想念什么吗?如果您需要更多详细信息,请询问。
繁花不似锦
相关分类