老师这个输出结果为什么控制器的结果不一样啊
来源:2-5 Spring Initializr构建Spring Boot应用
qq_慕莱坞4316410
2020-04-05 04:30:38
这是控制器的代码
package com.sikidu.demo.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/hello")
@ResponseBody
public String test(){
return "HelloSpringBoot";
}
}
这是网页的结果
Hello word!
这是控制台的结果
Connected to the target VM, address: '127.0.0.1:51251', transport: 'socket'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.6.RELEASE)
2020-04-05 04:28:11.558 INFO 26128 --- [ main] com.sikidu.demo.DemoApplication : Starting DemoApplication on DESKTOP-44IIV5B with PID 26128 (D:\C\SpringBoot框架的学习\springboot\target\classes started by Administrator in D:\C\SpringBoot框架的学习)
2020-04-05 04:28:11.561 INFO 26128 --- [ main] com.sikidu.demo.DemoApplication : No active profile set, falling back to default profiles: default
2020-04-05 04:28:12.152 WARN 26128 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.sikidu.demo]' package. Please check your configuration.
2020-04-05 04:28:12.452 INFO 26128 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-04-05 04:28:12.459 INFO 26128 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-04-05 04:28:12.459 INFO 26128 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.33]
2020-04-05 04:28:12.580 INFO 26128 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-04-05 04:28:12.580 INFO 26128 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 970 ms
2020-04-05 04:28:12.739 INFO 26128 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-04-05 04:28:12.808 WARN 26128 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2020-04-05 04:28:12.939 INFO 26128 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-04-05 04:28:12.945 INFO 26128 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-04-05 04:28:12.948 ERROR 26128 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8080 was already in use.
Action:
Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
2020-04-05 04:28:12.950 INFO 26128 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
Disconnected from the target VM, address: '127.0.0.1:51251', transport: 'socket'
Process finished with exit code 1
1回答
好帮手慕小班
2020-04-06
同学你好,根据同学贴出的报错内容:
项目启动失败,原因是8080端口已经被占用。查询8080端口被占用的步骤:
1)打开cmd,命令提示符,输入netstat -ano 会显示所有已经在运行的端口
2)输入你想要查的正在占用的端口号,netstat -ano|findstr 8080
此时会显示端口8080对应的tcp号
输入命令taskkill -f -pid 19644(这里是你自己对应的)
此时再重新启动试试。
如果我的回答解决了你的疑惑,请采纳,祝学习愉快~
相似问题