您好,我正在尝试使用 Eclipse 通过一个非常简单的应用程序来学习 Wildfly 和 springboot。项目名称是 springboot-test。包括主方法类在内的所有类都在同一个包中。
Main 方法类称为“App”,其代码如下:
@SpringBootApplication
@RestController
public class App {
@Autowired
private Student student;
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
@RequestMapping("/index")
public String sayHello()
{
return "hello from spring boot" + this.student.showAddress();
}
}
Run Code Online (Sandbox Code Playgroud)
以下是服务器日志:
11:36:57,281 信息 [org.wildfly.extension.undertow](ServerService 线程池 - 68)WFLYUT0021:已注册的 Web 上下文:服务器“default-server”的“/springboot-test-0.0.1-SNAPSHOT”
11:36:57,301 信息 [org.jboss.as.server](ServerService 线程池 - 37)WFLYSRV0010:部署了“springboot-test-0.0.1-SNAPSHOT.war”(运行时名称:“springboot-test-0.0” .1-SNAPSHOT.war")
11:36:57,408 信息 [org.jboss.as.server](控制器引导线程)WFLYSRV0212:恢复服务器
11:36:57,411 INFO [org.jboss.as](控制器启动线程)WFLYSRV0060:Http 管理接口监听http://127.0.0.1:8181/management
11:36:57,412 INFO [org.jboss.as](控制器启动线程)WFLYSRV0051:管理控制台监听http://127.0.0.1:8181
11:36:57,412 INFO [org.jboss.as](控制器启动线程)WFLYSRV0025:WildFly Full 11.0.0.Final(WildFly Core 3.0.8.Final)在 11393 毫秒内启动 - …