How To Find Out Spring Boot App Port No
Spring Boot had been built for Rapid Application Development. In this tutorial we will learn How to Create Spring Boot Application using some easy examples. We will also focus on How to deploy spring boot application in different application servers.
Here are the following topics that we will cover in this series:
- Create Spring Boot Application using
- start.spring.io
- Eclipse STS
- IntelliJ IDEA STS
- Run Spring Boot Application using
- Java CLI
- Eclipse/IntelliJ IDEA
- Create a Basic Spring Boot application using REST
- How to use Spring Actuator
- Deploy Spring Boot application in
- IBM Liberty Profile
- IBM Application Server 8.5
If you need an introduction of Spring Boot please find my previous post below.
An Introduction to Spring Boot
Create Spring Boot Application using start.spring.io
The best way of bootstrapping Spring Boot application is by using Spring Initializr. Let's first start by opening http//start.spring.io
.As you already know, you can use either Maven or Gradle to build, however we will use Maven in this tutorial. Click on Switch to the full Version
and you will be able to see the below screen.
Software Needed
- JDK 1.8 (You can use 1.7 or 1.6)
- Maven 3.x
Steps :
- Select
Maven Project
- If you want, change the Group/Package name. We will use
com.adeveloperdiary
- Change the Artifact to
SpringBoot
, Name will automatically change to the same - Leave the packaging to Jar, Java Version to 1.8 (Make sure you have JDK 1.8 in your local or use 1.7 )
- Either type the Dependencies or select them below. We will add
Web
andActuator
here - Click on Generate Project button to download the zip file
Now Extract the zip and you will have the following files.
Open Terminal and navigate to the above folder. Type mvn clean package
and press enter. The Build will start now.
Once the build has been completed, you will have the SpringBoot-0.0.1-SNAPSHOT.jar
created inside the target
folder.
The Size of the jar would be around 13MB
since it will have the embedded Tomcat server in it.
Create Spring Boot Application using Eclipse
We will use STS Toolkit to bootstrap when using eclipse. I am using eclipse MARS .1 version. We will first install the STS (SpringSource Tools Suite). Open Eclipse Marketplace, Type STS in Find and install the STS.
Then open Spring
perspective.
Create a New
-> Spring Starter Project
.
Enter the following details. Click Next.
Select Web
and Actuator
. Click on Next.
Click on Finish.
This should create the Spring Boot Project in Eclipse.
Create Spring Boot Application using IntelliJ IDEA
We will now use IntelliJ IDEA to create our Spring Boot Application.I recommend to use the latest version of IntelliJ. Create a New Project. Select Spring Initializr
. Click on Next.
Enter the following details. Click Next.
Select Web
and Actuator
. Click Next.
Enter the project Name and click Finish.
Your Spring Boot Project has been created now.
Run Spring Boot Application using CLI
We had created the jar file, now we will run it from Command Line by executing this line
java -jar target/SpringBoot-0.0.1-SNAPSHOT . jar |
You should be able to see Spring Boot in the Command Line.
The server should have started and the default port number will also be displayed as below.
Run Spring Boot Application in Eclipse
Its much easier to run the Spring Boot app in eclipse. Select the project, Right Click and, move to Run As
and click on Spring Boot App
. Again, remember you need to select the project to get this option, not the pom file.
Here is the output.
Run Spring Boot Application in IntelliJ IDEA
Its probably most easy, click on the run icon.
You should be able to see the logs that the application has started.
Conclusion
Hope this Step by Step approach will help you. Next we will learn how to create RESTServices and use Actuator in Spring Boot. Later we will also learn how to deploy Spring Boot Application in IBM Liberty Profile and IBM WAS 8.5 Server.
This is the 2nd part of Getting Started with Spring Boot Series. Find all the parts here.
- An Introduction to Spring Boot
- How to Create Spring Boot Application Step by Step
- How to create RESTFul Webservices using Spring Boot
- How to deploy Spring Boot application in IBM Liberty and WAS 8.5
How To Find Out Spring Boot App Port No
Source: https://www.adeveloperdiary.com/java/spring-boot/create-spring-boot-application-step-step/
Posted by: quinnpase1945.blogspot.com
0 Response to "How To Find Out Spring Boot App Port No"
Post a Comment