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 {
}

自定义FilterType指定过滤规则

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

猜你喜欢

转载自blog.csdn.net/csdn_kenneth/article/details/83410883