300===Dev Framework/Spring 20

How do you specify the base packages for component scanning in a Spring configuration class?

To specify the base packages for component scanning in a Spring configuration class, you use the @ComponentScan annotation with the basePackages attribute to indicate which packages should be scanned for components.The Big PictureSpecifying base packages for component scanning in a Spring configuration class is akin to giving precise instructions to a search party on where to look for important ..

Spring Bean 등록하는 4 가지 방법

4 가지 방법1. xml - Bean 태그 이용2. XML - componentScan 사용3. Config파일을 통한 Bean 등록4. Config의 ComponentScan을 활용한 Bean 등록1. xml - Bean 태그 이용Resource 폴더에 application.xml 생성application.xmlxml코드 복사 xml 파일을 로드하여 Application 실행DemoApplication.javajava코드 복사public class DemoApplication { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplication..

728x90
반응형