【发布时间】:2021-01-26 21:12:57
【问题描述】:
但是从浏览器访问 localhost:8080 时,我看到“无法访问站点错误”。 这里可能是什么问题。 甚至端口也没有被占用(通过 netstat 检查)。 以下是显示的日志:-
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.4.RELEASE)
2020-10-12 19:45:54.694 INFO 19756 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication on 8-UJLOP with PID 19756 (C:\Users\abc\Downloads\demo\demo\target\classes started by rsoni in C:\Users\abc\Downloads\demo\demo)
2020-10-12 19:45:54.695 INFO 19756 --- [ main] com.example.demo.DemoApplication : The following profiles are active: @spring.profiles.active@
2020-10-12 19:45:54.791 INFO 19756 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 0.312 seconds (JVM running for 0.869)
Application.properties——它只有下面提到的属性
pom XML
【问题讨论】:
-
分享您的开发配置文件的属性文件中的内容。
-
你确定它在 8080 上监听吗?你的项目中有
spring-boot-starter-web吗?我没有看到它通常附带的所有打印件(包括它侦听的端口 -
查看您的 pom 和属性文件会有所帮助
-
您应该检查项目端口是否为 8080。此外,有时 Internet Explorer 不会打开 localhost:8080。也许,问题是你的浏览器。如果您有多个浏览器,请尝试使用其他浏览器。
-
@NirLevy@Sajjad,谢谢.....添加spring boot starter web依赖后,它工作了。
标签: java spring spring-boot spring-security spring-boot-actuator