无法从Eclipse SpringBoot应用程序访问localhost:8080

时间:2020-10-12 14:29:15

标签: java spring spring-boot spring-security spring-boot-actuator

我正在运行一个简单的springboot演示应用程序 enter image description here

但是从浏览器访问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-它仅具有以下提到的属性

enter image description here

pom XML

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

向pom.xml添加以下依赖项有效:-

spring-boot-starter-web