@Component1 [Spring] bean을 스프링 컨테이너에 등록하는 방법 bean을 등록하는 방법은 2가지가 있다. 1. @component 어노테이션 빈으로 등록하고자 하는 클래스 위에 @component 어노테이션을 붙여주면 된다. 흔히 사용하는 @controller, @service, @repository 같은 어노테이션도 @component의 일종이다. 보통 사용자가 직접 생성한 객체를 등록하고 싶을 때 자주 사용한다. 2. @configuration, @bean 어노테이션 @configuration 어노테이션의 설명을 보면 Indicates that a class declares one or more @Bean methods and may be processed by the Spring container to generate bean definitions and se.. 2023. 7. 26. 이전 1 다음