Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- 혼자 공부하는 C언어
- buffer
- Serialization
- stream
- list 컬렉션
- JSON
- Stack
- datastructure
- s
- coding test
- insertion sort
- 윤성우의 열혈 자료구조
- Graph
- 이스케이프 문자
- 메모리구조
- C 언어 코딩 도장
- Selection Sorting
- Algorithm
- R
- 윤성우 열혈자료구조
- 알기쉬운 알고리즘
- C programming
- 이것이 자바다
Archives
- Today
- Total
Engineering Note
[Spring] @SpringBootApplication 어노테이션 본문
@SpringBootApplication은 @EnableAutoConfiguration, @ComponentScan, @Configuration을 합쳐놓은 어노테이션이다.
| 어노테이션 | 특징 및 설명 |
| @EnableAutoConfiguration | Spring Boot의 자동 설정 기능을 켜주는 어노테이션이다. Spring Boot가 클래스패스에 있는 라이브러리와 설정을 보고 적절한 Bean과 설정을 자동으로 구성하게 해준다. |
| @ComponentScan | 지정한 패키지 이하의 @Component 어노테이션이 붙은 클래스들을 찾아서 스프링 빈으로 등록해준다. @Service, @Repository, @Controller, @Component 등이 등록된 클래스들을 자동으로 DI(의존성 주입) 할 수 있게 해준다. 보통 @SpringBootApplication 클래스의 패키지 기준으로 스캔할 수 있다. |
| @Configuration | 이 클래스가 스프링 설정 클래스라는 걸 알려주는 역할을 한다. 여기 안에서 직접 @Bean 메서드를 만들어서 빈을 등록하거나, 다른 설정 클래스를 import할 수 있다. Spring이 이 클래스를 읽고 자바 코드 기반 설정을 가능하게 함 기존 XML 설정을 대체하기 위해 생긴 어노테이션이다. |
@EnableAutoConfiguration, @ComponentScan
- 스프링 컨테이너 초기화와 관련된 어노테이션
- @ComponentScan : @Configuration, @Repository, @Service, @Controller, @RestController가 붙은 객체를 메모리에 올리는 역할.
@Configuration 클래스 예시
@Configuration
public class AppConfig {
@Bean
public MyService myService() {
return new MyService();
}
}
참고 자료 : Spring 공식문서(https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/html/using-boot-using-springbootapplication-annotation.html),
'Server > Spring' 카테고리의 다른 글
| [Spring Boot] @DataJpaTest (0) | 2025.07.10 |
|---|---|
| [Spring] 스프링 부트 핵심 구성 요소 (0) | 2025.07.05 |
| [Spring] 의존성 주입(DI)과 스프링 빈 (0) | 2025.06.21 |
| [Spring Error] org.h2.jdbc.JdbcSQLNonTransientConnectionException: Connection is broken: "java.net.SocketTimeoutException: connect timed out (0) | 2022.08.23 |
| [Spring] Spring boot에 Swagger 적용하기(Maven) (0) | 2022.08.08 |
Comments
