如果使用这种扫描方式:
default-lazy-init="true" default-init-method="init" default-destroy-method="close"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> <property name="ignoreResourceNotFound" value="false" /> <property name="locations"> <list> <value>file:/data/**/**-wap.properties</value> </list> </property> </bean> <context:component-scan base-package="com.**.wap.controller"/> <context:component-scan base-package="com.**.wap.service"/> <context:component-scan base-package="com.**.wap.dao"/> </beans>
如果web.xml中扫描顺序出错也会报错:
Caused by: org.springframework.beans.TypeMismatchException:
解决如下:
Spring配置与扫描顺序
本文介绍了一种Spring配置方法,包括使用默认初始化方法、销毁方法及PropertyPlaceholderConfigurer配置属性占位符的方式。此外,还讨论了web.xml中扫描顺序错误可能导致的问题及解决方案。
1万+

被折叠的 条评论
为什么被折叠?



