banner



How To Find Out Spring Boot App Port No

How to Create Spring Boot Application Step by Step

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:


  1. Create Spring Boot Application using
    • start.spring.io
    • Eclipse STS
    • IntelliJ IDEA STS
  2. Run Spring Boot Application using
    • Java CLI
    • Eclipse/IntelliJ IDEA
  3. Create a Basic Spring Boot application using REST
  4. How to use Spring Actuator
  5. 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 and Actuator here
  • Click on Generate Project button to download the zip file

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Now Extract the zip and you will have the following files.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Open Terminal and navigate to the above folder. Type mvn clean package and press enter. The Build will start now.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

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.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

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.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Then open Spring perspective.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Create a New -> Spring Starter Project.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Enter the following details. Click Next.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Select Web and Actuator. Click on Next.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Click on Finish.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

This should create the Spring Boot Project in Eclipse.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

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.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Enter the following details. Click Next.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Select Web and Actuator. Click Next.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Enter the project Name and click Finish.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Your Spring Boot Project has been created now.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

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.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

The server should have started and the default port number will also be displayed as below.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

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.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Here is the output.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

Run Spring Boot Application in IntelliJ IDEA

Its probably most easy, click on the run icon.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

You should be able to see the logs that the application has started.

How to Create Spring Boot Application Step by Step adeveloperdiary.com

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.

  1. An Introduction to Spring Boot
  2. How to Create Spring Boot Application Step by Step
  3. How to create RESTFul Webservices using Spring Boot
  4. 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

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel