我的SpringBoot应用程序不会启动TomCat



我的程序编译了所有内容,我没有收到任何错误,但我实际上预计tomcat应该永久位于8080端口。输出中也没有弹簧。在另一个项目上,我做得很好。谢谢你帮我。

我的父母Pom:

<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>2.6.6</version>
<relativePath/>
</parent>
<groupId>org.example</groupId>
<artifactId>CalculatorWithRest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>app</module>
<module>infrastructure</module>
<module>domain-api</module>
<module>domain-core</module>
<module>rest-api</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>app</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
</project>

我的入门级:

package de.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class appstarter {
public static void main(String[] args) {
SpringApplication.run(appstarter.class, args);
}
}

我的入门Pom:

<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>CalculatorWithRest</artifactId>
<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>app</artifactId>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

控制台输出:

[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ rest-api ---
[INFO]
[INFO] CalculatorWithRest ................................. SUCCESS [  1.215 s]
[INFO] app ................................................ SUCCESS [  5.278 s]
[INFO] domain-api ......................................... SUCCESS [  3.251 s]
[INFO] infrastructure ..................................... SUCCESS [  3.075 s]
[INFO] domain-core ........................................ SUCCESS [  2.434 s]
[INFO] rest-api ........................................... SUCCESS [  2.871 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.843 s
[INFO] Finished at: 2022-07-26T15:49:58+02:00
[INFO] ------------------------------------------------------------------------

然后什么也没发生。Ty的帮助。

我看不到任何对的依赖

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

启动嵌入式tomcat。我认为你应该在你的应用程序pom中添加这个。

最新更新