Hackforge Academy

Category: React • Beginner

Published on 15 Apr 2026

Explanation

What is Spring Boot and why is it used?

Code Example

Spring Boot is a framework built on top 
of Spring that simplifies application
 development by providing 
auto-configuration, embedded servers,
 and production-ready features.

Example:
@SpringBootApplication
public class DemoApplication {
  public static void main(String[] args) {
    SpringApplication.run(DemoApplication.
class, args);
  }
}

Explanation

What is @SpringBootApplication annotation?

Code Example

@SpringBootApplication is a combination of:
1. @Configuration
2. @EnableAutoConfiguration
3. @ComponentScan

It enables auto configuration and 
component scanning.

Explanation

What is auto-configuration in Spring Boot?

Code Example

Auto-configuration automatically 
configures beans based on 
dependencies available in the classpath.

Example:
If spring-boot-starter-web is added, 
DispatcherServlet is configured 
automatically.

Explanation

What are Spring Boot Starters?

Code Example

Starter dependencies simplify 
dependency management.

Example:
<dependency>
  <groupId>org.springframework.boot
</groupId>
  <artifactId>spring-boot-starter-web
</artifactId>
</dependency>

Explanation

What is the difference between @Component, @Service, @Repository, and @Controller?

Code Example

@Component → Generic bean
@Service → Business logic layer
@Repository → Persistence layer
@Controller → Web MVC controller

Explanation

What is @RestController?

Code Example

@RestController combines 
@Controller and @ResponseBody.

Example:
@RestController
public class HelloController {
  @GetMapping("/hello")
  public String hello() {
    return "Hello Spring Boot";
  }
}

Want structured learning with real projects?

Join our Weekend Live Workshop and become job-ready faster.