Spring源码解析(二)——组件注册2

 

 

import com.ken.service.BookService;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Controller;

@Configuration
@ComponentScan(
		value = "com.ken",
		includeFilters = {
				@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = {Controller.class}),
				@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {BookService.class})
		},
		useDefaultFilters = false)
public class MainConfig {
}

Spring源码解析(二)——组件注册2_第1张图片

 

自定义FilterType指定过滤规则

 

https://blog.csdn.net/qq_34823865/article/details/79996936

 

 

 

 

 

 

你可能感兴趣的:(Spring源码解析)