springspring-bootmavenspring-initializr

My spring boot web app started but did not work?


So I am new to Spring boot, I have created some CRUDS with it before, But forgot about them & I am back to it again, So I started with the Spring Initializer, and here is the options I have selected :

  1. Project : Maven Project
  2. Language : Java
  3. Packaging : Jar
  4. Spring Boot : 2.3.4
  5. Java : 8

Then I generated the project, I imported the project in eclipse ( older version : Oxygen 2018 ), I had errors in pom.xml ( very common red icon ), I added a tag in pom.xml ( found a solution here already ), and updated my maven project and then it worked.

The tag added is :

<properties>
    <java.version>1.8</java.version>
    <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>

Time to run the project ? I runned the project as a Java application, I was waiting to see many things in log, one of them tells me what port I have to use, etc ..

But here what I got : enter image description here

So The Spring boot App started but I don't know where, when or how, and why so few logs not like ususal !

I tried running this localhost:8080 : default & localhost:8000 hoping that I will get something, but it seems like Tomcat server is not running or something.

Any help would be much appreciated.


Solution

  • You need to add dependencies to your pom, in order to have an embedded web server.

    When using Spring Initializr, you can select Spring Web (for servlet) or Spring Reactive Web (for reactive) from the dependencies menu. Since you're already past that stage, you can add either spring-boot-starter-web (for servlet) or spring-boot-starter-webflux (for reactive) to your pom.