Category: React • Beginner
Published on 17 Mar 2026
Explanation
Spring MVC is a Java web framework used to build web applications using the Model-View-Controller design pattern. It separates application logic, user interface, and request handling.
Code Example
@Controller
public class HelloController {
@RequestMapping("/hello")
public String hello(Model model) {
model.addAttribute("message",
"Hello from Spring MVC");
return "hello";
}
}
Explanation
Spring Boot is a framework built on top of Spring that simplifies application development by providing auto-configuration and embedded servers like Tomcat.
Code Example
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello() {
return "Hello from Spring Boot";
}
}
Explanation
The @SpringBootApplication annotation enables auto configuration, component scanning, and configuration support to quickly bootstrap a Spring Boot application.
Code Example
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class,
args);
}
}
Explanation
Spring Boot provides starter dependencies like spring-boot-starter-web which automatically include libraries required to build web applications.
Code Example
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
Explanation
In Spring MVC, @RequestMapping maps HTTP requests to controller methods, allowing developers to define URL endpoints easily.
Code Example
@RequestMapping("/users")
public String users() {
return "users";
}