Creating a Spring Boot Application Using STS

Hello Friends!, today we are going to learn a step-by-step process to create Spring Boot Application in STS or Eclipse with STS plugging.

you can check our other post

how to create a Spring Boot Application with Eclipse and Maven, in this post we will learn how to create Spring Boot application from the maven project and that is manually.

how to Create a Spring Boot Application with Spring Initializr.

Create Spring Starter Project

Open Eclipse/STS , click on

File -> New -> Spring Starter Project

or

File -> New -> Project... select Spring Boot -> Spring Starter Project

and choose the following as per your project as show in image.

  • Name: employee-service
  • Group: com.gyanideveloper.springboot
  • Artifact: employee-service
  • Version: 0.0.1-SNAPSHOT
  • Description: Empoyee Service
  • Package : com.gyanideveloper.springboot.employee.service
  • Type : Maven

update below if required.

  • Packaging
  • Java Version
  • Language

and click on Next

Type should be Maven as we are developing a maven based Spring Boot application in this tutorial.

in the next screen, choose the Spring Boot Version and search and add dependencies are required for your project as shown in the image.

click on Finish , it will take time to generate project and Maven to download dependencies.

Run Spring Boot Application

your project structure will look like below.

Choose File -> Run as -> Spring Boot App as shown in image.

It start your Spring Boot application on port number 8080 , we can find console log as below.

if you get any issue such as Error: Could not find or load main class com.gyanideveloper.springboot.employee.service.EmployeeServiceApplication, please clean and build the project choose File -> Run As -> Maven build and choose a Goals clean install and click on Run

If the application fails to start because the port is in use. please check our How to Change the Default Port in Spring Boot post for more details.

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

2020-05-23 16:46:42.584  INFO 12724 --- [  restartedMain] c.g.s.e.s.EmployeeServiceApplication     : Starting EmployeeServiceApplication on DESKTOP-ABZXVP with PID 12724 (F:\workspace-spring-tool-suite-4-4.6.1.RELEASE\employee-service\target\classes started by Gyani in F:\workspace-spring-tool-suite-4-4.6.1.RELEASE\employee-service)
2020-05-23 16:46:42.612  INFO 12724 --- [  restartedMain] c.g.s.e.s.EmployeeServiceApplication     : No active profile set, falling back to default profiles: default
2020-05-23 16:46:42.657  INFO 12724 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-05-23 16:46:42.658  INFO 12724 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-05-23 16:46:43.845  INFO 12724 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-05-23 16:46:43.853  INFO 12724 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-05-23 16:46:43.853  INFO 12724 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.35]
2020-05-23 16:46:43.911  INFO 12724 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-05-23 16:46:43.911  INFO 12724 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1253 ms
2020-05-23 16:46:44.163  INFO 12724 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-05-23 16:46:44.468  INFO 12724 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2020-05-23 16:46:44.473  INFO 12724 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-05-23 16:46:44.572  INFO 12724 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-05-23 16:46:44.589  INFO 12724 --- [  restartedMain] c.g.s.e.s.EmployeeServiceApplication     : Started EmployeeServiceApplication in 2.412 seconds (JVM running for 3.276)

Your first application is ready.

Final Note

we have learn how to create spring boot application by using STS or Eclipse with STS plugging..

4 thoughts on “Creating a Spring Boot Application Using STS”

Leave a Comment