Hello Jay

Hello Jay


Spring Boot Eclipse and CLI Setup to Run Spring Boot Applications

Install Spring Tool Suite (STS) in Eclipse

Step 1: To use Eclipse on Windows, you need to first install Java Development Kit (JDK). You can download JAVA from the Oracle site.

Step 2: Accept the License Agreement and choose the executable file for the operating system. Here I would be downloading for Windows with 64 bit. Refer to the snapshot below.

Step 3: Once the download is complete, run the exe for install JDK. and click Next. Refer to the snapshot below.

Step 4: After the installation is complete click on Close

Step 5: Now, set the environment variables in Java.

Step 5.1: Right-click on My Computer/This PC -> More -> Properties. 

Step 5.2: Go to Advanced System Settings -> Environment Variables.

Step 5.3: Add JAVA_HOME variable in the Windows environment, and point it to your Java JDK folder. Refer to the snapshot below.

Step 5.4: Update the PATH variable, and append the Java bin folder. Refer to the snapshot below.

Step 5.6: To verify if Java is installed or not, type java -version on the command prompt.

Step 6: After JAVA has been configured in your PC, you can download Eclipse IDE for JAVA JEE Developers and extract these files to a specific folder.

Step 7: Once you are done installing Eclipse on your PC, go to Help -> Eclipse MarketPlace. A dialog box opens up with a list of all the available software. Search for Spring Tool Suite (STS) and Install it.

Step 8: Once the tool is installed, click on File -> New -> Other. A dialog box opens up. In that, select Spring Boot Starter Project under the Spring Boot option and click Next.

Step 9: In the next screen that opens up, choose the following for your project:

  • Group ID
  • Artifact ID
  • Root package
  • Version
  • Description
  • Java version
  • Language
  • Packaging

Here, make sure you select Maven as Type and click Next. Refer to the snapshot below.

Step 10: In the next dialog box that shows up, select the dependencies that you want to add to your Spring Boot Eclipse Project and click Finish. Refer the snapshot below.

Step 11: Now, you will observe that your SpringBoot Eclipse project has been created on the left-hand side of the Eclipse IDE.

Step 12: After the project is created, configure the classes for your application according to your needs.

Step 13: To run this newly created Spring Boot Eclipse project, right-click on the project, and select Run As – > Spring Boot App. Internally this method creates an instance of the embedded Tomcat server at the default port of 8080 and runs the application in it. Refer to the snapshot below.

Now, let us explore the second option.

Spring Boot CLI Setup

Step 1: To create Spring Boot Eclipse project first download Apache Maven and Spring Boot CLIfrom their respective official sites.

Step 2: Download Apache Maven

Step 2.1: Visit Maven official website and download the Maven zip file, for example, apache-maven-3.5.2-bin.zip.

Step 2.2: Unzip it to the folder you want to install Maven.

Assume that you unzip to this directory C:pache-maven-3.5.2.

Step 2.3: Add M2_HOME and MAVEN_HOME variables in the Windows environment, and point it to your Maven folder.

Step 2.4: Update the PATH variable, and append the Maven bin folder –C:pache-maven-3.5.2in.Refer to the snapshot below.

Step2.5: Verify whether maven is installed or not, with mvn -version command in the command prompt.

Step 3: Download the Spring Boot CLI tool

Step 3.1: Download Spring Boot CLI from its official website.

Step 3.2: Unzip the downloaded file the folder you want to install Spring CLI.

Assume that you unzip it to this directory C:spring-2.0.0.RELEASE.

Step 3.3: Add SPRING_HOME variable in the Windows environment, and point it to your Spring folder. Refer to the snapshot below.

Step 3.4: Update the PATH variable, and append the Spring bin folder – C:spring-2.0.0.RELEASEin. Refer to the snapshot below.

Step 3.5: Verify whether Spring is installed or not, with spring –version command in the command prompt.

Step 4: Now go to your project directory where you have created the Spring project and copy the path.

Step 5: Change the working directory to the project path on the command prompt using the command cd. Assume here the path is C:UsersSahitiDesktopExample.

Step 6: Run the project using the command mvn spring-boot:run

Now let us create a Hello World Application in both the ways.

Spring Boot Hello World Example

Initially, let us create a maven project by choosing Spring Starter project wizard from the file menu of Eclipse IDE with the name HelloWorld_Example and select the required dependencies.

This application has an auto-created Java file.This Java file acts an entry point for the application. It imports classes and uses annotations. Refer to the snapshot below.

Even though this application acts ready as a stand-alone application, we will still add a configuration file to it. This will help us handle the HTTP requests. Refer to the snapshot below.

Now, run the application as a Spring Boot App. You observe that the application has started and produces the following output on the console.

This application runs on 8080. So, if we pass /hello request to the following port number, then it produces the message returned from the requested method in the configuration file. Refer to the snapshot below.

If you want to run this project using the Spring Boot CLI, then open the command prompt and change your working directory to the project path. 

Now type mvn spring-boot:run to run this project. This will give you the following output indicating whether the application has started or not.

Now you can run on the browser and it this produces the same output as the previous.

Thank you for reading!

#spring-boot #mobile-apps #web-development

What is GEEK

Buddha Community

Spring Boot Eclipse and CLI Setup to Run Spring Boot Applications
Sigrid  Farrell

Sigrid Farrell


How To Create Spring Boot Project In Eclipse

Java programming language is often said to be too complicated and cumbersome in terms of building simple applications. However, Java provides a stable platform that offers an extremely mature ecosystem which makes it possible for developers to create robust software without much hassle.

The Spring Framework – one of the many powerful frameworks present in the Java ecosystem – brings with it a collection of configuration and programming models to simplify the development and testing of applications in Java.

In this article, we’ll go through some of the useful features of the STS IDE (Eclipse Spring Tool Suite), which are useful for you when developing Spring Boot projects or applications in Eclipse. We’ll talk about the various benefits of STS as opposed to the traditional way of building Spring applications with Eclipse.

Then, we’ll look at how to bootstrap an application, how to execute it, and eventually, how to add additional dependencies. Finally, we’ll conclude this tutorial by adding applications arguments.

#full stack development #spring boot project in eclipse #spring boot project #eclipse #how to create spring boot project in eclipse

Were  Joyce

Were Joyce


How to Configure the Interceptor With Spring Boot Application

In the video in this article, we take a closer look at how to configure the interceptor with the Spring Boot application! Let’s take a look!

#spring boot #spring boot tutorial #interceptor #interceptors #spring boot interceptor #spring boot tutorial for beginners

Were  Joyce

Were Joyce


Spring vs Spring BooDifference Between Spring and Spring Boot

As an extension of the Spring Framework, Spring Boot is widely used to make development on Spring faster, more efficient and convenient. In this article, we will look at some of the parameters were using Spring Boot can drastically reduce the time and effort required in application development.

What is Spring?

Spring Boot

Difference between Spring and Spring Boot

Advantages of Spring Boot over Spring


#full stack development #spring #spring and spring boot #spring boot

Sigrid  Farrell

Sigrid Farrell


How to Configure log4j2 In a Spring Boot Application? | Spring Boot Logging [Video]

Configuring log4j2 is really quick and simple; this tutorial video explains the entire process in only 5 minutes, while you wait for your coffee to brew.

In the video below, we take a closer look at the How to configure log4j2 in the Spring boot application using log4j2.xml? | Spring Boot logging. Let’s get started!

#java #spring boot #video #log4j #spring boot tutorial #spring boot tutorial for beginners

Were  Joyce

Were Joyce


How to Bootstrap a Spring Boot Application? Maven Project

In this article, take a closer look at how to bootstrap a Spring Boot application.

In the video below, we take a closer look at how to bootstrap a Spring Boot application. Let’s get started!

#java #tutorial #spring boot #maven #spring boot tutorial #bootstrap a spring boot application