maven - Spring Boot应用程序没有启动tomcat

标签 maven spring-boot tomcat

我已经使用 spring boot 编写了 web 服务。 当我运行它时,它只是作为 JVM 进行构建和运行

package com.example.demo;

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

    @SpringBootApplication
    public class SpringTestApplication {

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

    }

   .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.1.6.RELEASE)

    2019-07-10 09:25:01.964  INFO 683 --- [ main] com.example.demo.SpringTestApplication   : Starting SpringTestApplication on     Amits-MacBook-Air.local with PID 683 (/Users/amitpatil/Downloads/demo/target/classes started by amitpatil in /Users/amitpatil/Downloads/demo)
    2019-07-10 09:25:01.967  INFO 683 --- [ main] com.example.demo.SpringTestApplication   : No active profile set, falling back     to default profiles: default
    2019-07-10 09:25:03.298  INFO 683 --- [ main] com.example.demo.SpringTestApplication   : Started SpringTestApplication in     7.067 seconds (JVM running for 7.826)

Process finished with exit code 0

最佳答案

Process finished with exit code 0 意味着一切正常ok。如果程序中发生异常或以其他方式生成带有非零参数的退出。

我推荐使用 Spring Initializr使用 embedded tomcat 引导您的 spring boot 应用程序。此外,我建议使用 Intelliju IDE 来处理您的应用程序。这应该可以轻松启动您的应用程序开发。

关于maven - Spring Boot应用程序没有启动tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56963203/

相关文章:

java - Springboot同步方法

java - Tomcat websocket 客户端框架

java - mac intellij idea tomcat无法显示tomcat主页

git - Bamboo 通用构建计划

java - 无法访问资源文件夹中的文件

java - 在 pom.xml 中指定 wsdl url 并将 wsdl jar 下载到本地计算机

spring-boot - 在 Spring boot gradle multiproject 中,gradlew bootRun 可以,但是运行生成的 jar 不行

maven - mvn :install to place my jar in nexus remote repository

java - 在浏览器中直接点击 post 方法 url 时显示错误消息

tomcat - 云类型转换厂 : Set Environment Variables via Manifest. yml