Spring Boot 주요 어노테이션
### **📌 Spring Boot에서 꼭 알아야 할 주요 어노테이션 정리!** 🚀 Spring에는 **많은 어노테이션이 있지만, 기본적으로 자주 쓰이는 것들만 먼저 익히면 돼.**\ 💡 **기본적으로 알아야 할 어노테이션은 크게 5가지 카테고리로 정리할 수 있어.** * * * * * **📌 1️⃣ Spring 핵심 어노테이션 (빈 & 의존성 주입)** --------------------------------------- | 어노테이션 | 역할 | | --- | --- | | `@Component` | **Spring 빈(객체)으로 등록** | | `@Service` | **비즈니스 로직을 담당하는 서비스 레이어 등록** (`@Component`와 같은 역할) | | `@Repository` | **데이터베이스와 연결되는 레이어 등록** (예: JPA Repository) | | `@Controller` | **Spring MVC 컨트롤러 등록** (사용자 요청 처리) | | `@RestController` | `@Controller + @ResponseBody` (JSON 응답을 반환하는 컨트롤러) | | `@Autowired` | **Spring이 자동으로 의존성 주입** | 📌 **예제** ``` @Component public class MyComponent { public void hello() { System.out.println("Hello from MyComponent!"); } } ``` ``` @Service public class MyService { private final MyComponent myComponent; @Autowired // ✅ 의존성 주입 public MyService(MyComponent myComponen...