Java:Eclipse控制台没有';t显示弹簧控制器信息
当我在Eclipse4.7.3IDE中运行SpringBoot应用程序时,控制台不会显示有关rest控制器的信息。然而,当我用浏览器测试控制器时,它仍在工作 它只是一个“Hello World”应用程序:Java:Eclipse控制台没有';t显示弹簧控制器信息,java,eclipse,spring-boot,servlets,Java,Eclipse,Spring Boot,Servlets,当我在Eclipse4.7.3IDE中运行SpringBoot应用程序时,控制台不会显示有关rest控制器的信息。然而,当我用浏览器测试控制器时,它仍在工作 它只是一个“Hello World”应用程序: import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication pub
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HelloWorldSpringBootApp {
public static void main(String[] args) {
SpringApplication.run(HelloWorldSpringBootApp.class, args);
}
}
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@RequestMapping(value = "/")
public String helo() {
return "Hello World!";
}
}
输出:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.4.RELEASE)
2019-04-28 09:08:33.768 INFO 2208 --- [ main] c.infotech.app.HelloWorldSpringBootApp : Starting HelloWorldSpringBootApp on OfficeLaptop01 with PID 2208 (C:\Users\Admin\eclipse-workspace4.7.3a\Sprang\HelloWorldSpringBoot\target\classes started by Admin in C:\Users\Admin\eclipse-workspace4.7.3a\Sprang\HelloWorldSpringBoot)
2019-04-28 09:08:33.775 INFO 2208 --- [ main] c.infotech.app.HelloWorldSpringBootApp : No active profile set, falling back to default profiles: default
2019-04-28 09:08:34.852 INFO 2208 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-04-28 09:08:34.873 INFO 2208 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-04-28 09:08:34.873 INFO 2208 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.17]
2019-04-28 09:08:34.978 INFO 2208 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-04-28 09:08:34.978 INFO 2208 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1157 ms
2019-04-28 09:08:35.183 INFO 2208 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-04-28 09:08:35.348 INFO 2208 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-04-28 09:08:35.351 INFO 2208 --- [ main] c.infotech.app.HelloWorldSpringBootApp : Started HelloWorldSpringBootApp in 1.904 seconds (JVM running for 2.561)
如上所述,它只显示到“在1.904秒内启动HelloWorldSpringBootApp”,而不显示请求映射状态和映射URL路径信息。为什么?。该变更记录表明:
如果您正在尝试调试应用程序并希望恢复
SpringBoot2.0风格的日志记录您应该在日志中添加以下内容
application.properties
然而,鉴于此RestController
@RestController
public class HelloWorldController {
@RequestMapping(value = "/hello")
public String hello() {
return "Hello World!";
}
}
如果我将日志级别设置为trace
,它将给出预期的输出(尽管与SpringBoot2.1的方式不同)
对跟踪
日志级别的要求很可能是由于Spring Framework 5.1(请参阅)中的更改。该变更记录表明:
如果您正在尝试调试应用程序并希望恢复
SpringBoot2.0风格的日志记录您应该在日志中添加以下内容
application.properties
然而,鉴于此RestController
@RestController
public class HelloWorldController {
@RequestMapping(value = "/hello")
public String hello() {
return "Hello World!";
}
}
如果我将日志级别设置为trace
,它将给出预期的输出(尽管与SpringBoot2.1的方式不同)
对
跟踪
日志级别的要求很可能是由于Spring Framework 5.1(请参阅)中的更改请尝试调试级别日志,并查看确切的信息?请尝试调试级别日志,查看确切的信息?
10:53:26.427 [main] TRACE o.s.w.s.m.m.a.RequestMappingHandlerMapping -
c.i.e.d.r.HelloWorldController:
{ /hello}: hello()