-
加载Controller(spring-mvc.xml)
<context:component-scan base-package="com.buss.*">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" />
</context:component-scan>
-
加载service(spring-mvc-hibernate.xml)
<context:component-scan base-package="com.buss.*">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>
-
扫描hibernate实体(spring-mvc-hibernate.xml)
如果生成代码时,代码分层风格选择了“代码分层”,则配置文件如下:
<property name="packagesToScan">
<list>
....
<!-- 扫描 代码分层 实体 -->
<value>com.buss.entity.*</value>
<!-- 扫描 业务分层 实体 -->
<value>com.buss.*.entity</value>
</list>
</property>