@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)@Documented@Inherited@SpringBootConfiguration@EnableAutoConfiguration@ComponentScan(excludeFilters = { @Filter(type =FilterType.CUSTOM, classes =TypeExcludeFilter.class), @Filter(type =FilterType.CUSTOM, classes =AutoConfigurationExcludeFilter.class) })public @interfaceSpringBootApplication {/** * Exclude specific auto-configuration classes such that they will never be applied. * @return the classes to exclude */ @AliasFor(annotation =EnableAutoConfiguration.class)Class<?>[] exclude()default {};/** * Exclude specific auto-configuration class names such that they will never be * applied. * @return the class names to exclude * @since 1.3.0 */ @AliasFor(annotation =EnableAutoConfiguration.class)String[] excludeName()default {};...}
Consider renaming one of the beans or enabling overriding by setting
spring.main.allow-bean-definition-overriding=true
ํ ์คํธ ์ฝ๋๋ก ํ์ธ
๊ธฐ๋ณธ @ComponentScan ๋น๋ฑ๋ก ํ์ธ
packagedh0023.springcore.scan;importdh0023.springcore.config.AutoAppConfig;importdh0023.springcore.member.service.MemberService;importorg.assertj.core.api.Assertions;importorg.junit.jupiter.api.Test;importorg.springframework.context.ApplicationContext;importorg.springframework.context.annotation.AnnotationConfigApplicationContext;publicclassAutoAppConfigTest { @TestvoidbasicScan() {ApplicationContext ac =newAnnotationConfigApplicationContext(AutoAppConfig.class);MemberService memberService =ac.getBean(MemberService.class);Assertions.assertThat(memberService).isInstanceOf(MemberService.class); }}
23:44:34.697 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerProcessor'23:44:34.701 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory'23:44:34.713 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'23:44:34.716 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'23:44:34.739 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'autoAppConfig'23:44:34.748 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'rateDiscountPolicy'23:44:34.749 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'memoryMemberRepository'23:44:34.750 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'memberServiceImpl'23:44:34.858 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Autowiring by type from bean name 'memberServiceImpl' via constructor to bean named 'memoryMemberRepository'23:44:34.860 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Creating shared instance of singleton bean 'orderServiceImpl'23:44:34.865 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Autowiring by type from bean name 'orderServiceImpl' via constructor to bean named 'memoryMemberRepository'23:44:34.866 [main] DEBUGorg.springframework.beans.factory.support.DefaultListableBeanFactory-Autowiring by type from bean name 'orderServiceImpl' via constructor to bean named 'rateDiscountPolicy'