小编Nav*_*shi的帖子

无法在 Spring Boot 应用程序(Tomcat 服务器)中运行 localhost

我一直在使用以下教程学习 Spring:https : //www.youtube.com/playlist?list=PLqq-6Pq4lTTbx8p2oCgcAQGQyqN8XeA1x

我创建了一个 Maven 项目,并在参考这些视频时尝试运行 Spring Boot 应用程序:

https://www.youtube.com/watch?v=E7_a-kB46LU&index=9&list=PLqq-6Pq4lTTbx8p2oCgcAQGQyqN8XeA1x

我试图在 Tomcat 服务器上运行我的 Spring 应用程序,但本地主机不起作用。(端口 8080)

我的 pom.xml 看起来像这样:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.javabrains.springbootquickstart</groupId>
  <artifactId>course-api-new</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>Java Brains Course API</name>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.2.RELEASE</version>
  </parent>

  <dependencies>
       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
       </dependency>
  </dependencies>

  <properties>
        <java.version>1.8</java.version>
  </properties>

</project>
Run Code Online (Sandbox Code Playgroud)

CourseApiApp.java :

package io.javabrains.springbootstarter;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class CourseApiApp {

    public static void main(String[] args) {
        SpringApplication.run(CourseApiApp.class, args);

    }

}
Run Code Online (Sandbox Code Playgroud)

根据视频 localhost 在运行应用程序时应该显示白名单错误,但它根本不运行。

任何帮助将不胜感激,谢谢!

tomcat pom.xml maven spring-tool-suite spring-boot

1
推荐指数
2
解决办法
3万
查看次数

标签 统计

maven ×1

pom.xml ×1

spring-boot ×1

spring-tool-suite ×1

tomcat ×1