0% found this document useful (0 votes)
66 views

Spring Boot Session-2

This document provides instructions for downloading, installing, and creating a basic Spring Boot project using Spring Tool Suite (STS) IDE. It describes downloading STS from the Spring website, extracting and launching the IDE, and creating a new Maven project within STS. It also explains how to modify the application.properties file to change the server port number and how to create a basic controller class and run the Spring Boot application.

Uploaded by

Tejas Agrawal
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Spring Boot Session-2

This document provides instructions for downloading, installing, and creating a basic Spring Boot project using Spring Tool Suite (STS) IDE. It describes downloading STS from the Spring website, extracting and launching the IDE, and creating a new Maven project within STS. It also explains how to modify the application.properties file to change the server port number and how to create a basic controller class and run the Spring Boot application.

Uploaded by

Tejas Agrawal
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Download and Install STS IDE

Spring Tool Suite (STS) IDE

--> Spring Tool Suite is an IDE to develop Spring applications.


It is an Eclipse-based development environment.
It provides a ready-to-use environment to implement, run, deploy,
and debug the application.

step 1: Download Spring Tool Suite from https://spring.io/tools4/sts/all.

Step 2: Extract the zip file and install the STS.

sts-bundle -> sts-3.9.9.RELEASE -> Double-click on the STS.exe.

Step 3: Spring Tool Suite 4 Launcher dialog box appears on the screen.

Click on the Launch button. Here give your Workspace location if required.

Step 4: It starts launching the STS.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Creating a Spring Boot Project Using STS
-------------------------------------------------------------------
Step 1: Open the Spring Tool Suite.

Step 2: Click on the File menu -> New -> Maven Project

Step 4: Provide the Group Id


and Artifact Id and package name then click on the Finish button.

Step5: open application.java --> it is main file to exexute our spring boot
application.
suppose you want to change server port number then go with
application.properties file

in that type

server.port:portnumber

server.port:2022

--> by default spring boot application port number is : 8080

--> to execute spring boot application on web browser use

localhost:8080
localhost:2022
127.0.0.1:2022

step6: create a controller with Mycontroller name

step7: Then run application.

INVASIVE:
ex:
---
servlet class
struts

ex:
---
class Myservlet implements Servlet
{

}
class Myservlet extends GenericServlet
{

}
class Myservlet extends HttServlet
{

---------------------------------
Controller
-----------------
class MyControlle implements Controller
{
public ModelAndView handleRequest(-,-)
{

return new ModelAndView();


}
}
----------------------------------------------------
class MyControlle extends AbstractCommandController
{
public ModelAndView handle(-,-)
{

return new ModelAndView();


}

}
------------------------------------------------
NON-INvasive
----------------
@Controller
class MyController
{
@RequestMapping("/url1")
@ResponseBody
public String mymethod()
{
return "string data";
}
}
==========================================================
MyController.java
----------------

package com.stech;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class MyController {
@RequestMapping("/url1")
@ResponseBody
public String show() {
return "Welcome Spring Boot";
}
@RequestMapping("/url2")
@ResponseBody
public String about() {
return "Welcome About web Page";
}
}

You might also like