-1

I am new to Spring and Spring Boot and this might be a very basic question but I am confused while running the spring boot app.

I am using STS as my IDE. I have created a Spring boot application using spring boot starter. To run the spring boot application I see Run As - Spring Boot Application , Java Application.

  1. What is the difference between running as Spring Boot Application and Java Application.
  2. From the command prompt I can execute the jar using java -jar demo.jar . java -jar demo.jar runs the jar as a spring boot application or a Java Application? If spring boot application , how can I run it as a java application from the command prompt.

Thanks in advance.

Umesh Sanwal
  • 681
  • 4
  • 13

1 Answers1

0
  1. Actually Spring Boot is developed as supportive framework which build on java base configuration. Normally when you create simple java application you need to place many stuff hard coded like database configuration, Utility classes, Configuration class and etc. Spring Boot basically developed for do this steps by their self after adding some common configuration so you can complete focus on main logic or stuff.

  2. Using spring boot you can create jar which it's like package which contain class file your various dependencies and configuration files. Which execute by single stuff.

For execution, Create jar using command, mvn clean install, it store your jar in target folder. open terminal and go that place and run command java -jar .jar Which execute your project on defined port default is 8080.

Dhwanil Patel
  • 2,273
  • 1
  • 18
  • 28