1 在主容器中(applicationContext.xml),将Controller的注解打消掉

<context:component-scan base-package="exampleBean">
		<context:exclude-filter type="annotation"
			expression="org.springframework.stereotype.Controller" />
	</context:component-scan>

2 在主容器中(applicationContext.xml),按正则过滤指定类

	<context:component-scan base-package="exampleBean">
	<!-- 过滤掉exampleBean下的且类名以Default开头的类 -->
		<context:exclude-filter type="regex"
			expression="exampleBean\.Default*" />
	</context:component-scan>

3 在主容器中(applicationContext.xml),按指定类名过滤指定类

	<context:component-scan base-package="exampleBean">
	<!-- 过滤掉exampleBean下的类名为<span style="font-family: Arial, Helvetica, sans-serif;">MovieFinder</span>的类 -->
		<context:exclude-filter type="assignable" expression="exampleBean.MovieFinder"/>
	</context:component-scan>


Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐