0

Started learning Spring framework, but I have a problem where by my project builds successfully but it wont finish running...

pom file

<?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>3.2.2</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.sivcodes</groupId>
    <artifactId>spring-boot-example</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-boot-example</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

SpringBootExampleApplication.java

package com.sivcodes;

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

@SpringBootApplication
public class SpringBootExampleApplication {

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

}

Picture of the output

I have searching the internet for the answer but nothing relevant comes up.

4
  • 1
    And why should it? It is a server application (you included spring-boot-starter-web), if it would shutdown directly nothing would be able to connect to it. Commented Feb 5, 2024 at 10:45
  • Everything works as it should, there is nothing to stop. Or do you want to stop your webserver running immediately after start? Commented Feb 5, 2024 at 10:46
  • Thank you guys for pointing that out. I think I didn't clearly explain the problem I have. but I found the solution to it, the port 8080 is being used by another service. Commented Feb 5, 2024 at 10:56
  • 2
    Don't know what you're saying, the Tomcat status log of your picture tells that Tomcat is running on port 8080, so there can't be another service using that specific port. That's impossible by design. Commented Feb 5, 2024 at 12:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.