英文:
Unable to access localhost:8080 from eclipse springboot application
问题
我正在运行一个简单的 Spring Boot 演示应用程序。
但是,在从浏览器访问 localhost:8080 时,我看到"无法访问该站点"的错误。可能是什么问题呢?即使端口没有被占用(通过 netstat 检查)。
以下是显示的日志:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_.__/ \ / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.4.RELEASE)
2020-10-12 19:45:54.694 INFO 19756 --- [ main] com.example.demo.DemoApplication : 正在启动 DemoApplication,PID 为 19756(位于 C:\Users\abc\Downloads\demo\demo\target\classes,由 rsoni 在 C:\Users\abc\Downloads\demo\demo 中启动)
2020-10-12 19:45:54.695 INFO 19756 --- [ main] com.example.demo.DemoApplication : 激活的配置文件为:@spring.profiles.active@
2020-10-12 19:45:54.791 INFO 19756 --- [ main] com.example.demo.DemoApplication : 在 0.312 秒内启动了 DemoApplication(JVM 运行时间为 0.869 秒)
application.properties-- 它只包含以下属性:
pom XML
如果您需要更多帮助,请随时问我。
英文:
I am running a simple springboot demoapplication
But while accessing the localhost:8080 from browser, I see "Site can't be reached error".
What could be the issue here.
Even the port is not occupied(checked via netstat).
Below are the logs, displayed:-
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: 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-- it only has the below mentioned property
pom XML
答案1
得分: 0
将以下依赖项添加到 pom.xml 中成功:-
spring-boot-starter-web
英文:
Adding the following dependency to pom.xml worked:-
spring-boot-starter-web
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论