@Component 어노테이션은 클래스 레벨에서 사용
@Bean 어노테이션은 메서드 레벨에서 사용
https://standout.tistory.com/474
Annotation - @Bean @Scope
@Bean 빈은 Spring 컨테이너에서 생성되고 관리되는 객체 개발자가 직접 제어가 불가능한 외부 라이브러리등을 Bean으로 만들려할 때 주로 사용된다. @Configuration public class MyConfiguration { @Bean public MyBe
standout.tistory.com
https://standout.tistory.com/476
Annotation - @Component
@Component 개발자가 직접 작성한 Class를 Bean으로 등록하기 위한 Annotation 스프링 MVC에서는 @Component 어노테이션의 특화된 형태인 @Controller, @Service, @Repository 등이 사용된다. @Component public class MyComponent
standout.tistory.com
'JAVA > Spring' 카테고리의 다른 글
Annotation - @Autowired @Qualifier (0) | 2023.04.19 |
---|---|
Annotation - @Component (0) | 2023.04.19 |
Annotation - @Bean @Scope (0) | 2023.04.19 |
공통처리 삼총사, Filter Interceptor AOP (0) | 2023.04.17 |
Spring boot, thymeleaf static 파일 인식오류, 404에러 (0) | 2023.04.17 |