Reputation: 3296
When i run a springboot application with command "mvn spring-boot:run" then it starts tomcat and keep running but same application when started from Intellij from main class "com.example.demo.DemoApplication" then it shuts down immediately with below logs. How to run it from IDE:
:: Spring Boot :: (v2.6.3)
2022-01-30 14:02:25.137 INFO 11024 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 1.8.0_291 on LAPTOP-1D3EOLKG with PID 11024 (C:\Users\SurajBahl\Downloads\demo\target\classes started by suraj.bahl in C:\Users\SurajBahl\Downloads\demo)
2022-01-30 14:02:25.139 INFO 11024 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
2022-01-30 14:02:25.907 INFO 11024 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 1.214 seconds (JVM running for 2.099)
Process finished with exit code 0
POM xml is as below
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2021.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-function-web</artifactId>
<version>3.0.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Upvotes: 1
Views: 639