ssh架构中的问题

来源:百度知道 编辑:UC知道 时间:2024/05/19 03:14:25
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logInfo' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.service.impl.LogInfoServiceImpl] to required type [com.service.LogInfoService] for property 'logInfoService'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.service.impl.LogInfoServiceImpl] to required type [com.service.LogInfoService] for property 'logInfoService': no matching editors or conversion strategy found
Caused by: org.springframework.beans.

所有的问题归结只有一个问题:
Failed to convert property value of type [com.service.impl.LogInfoServiceImpl] to required type [com.service.LogInfoService] for property 'logInfoService';

类型不匹配
com.service.LogInfoService应该是一个接口
而com.service.impl.LogInfoServiceImpl是它的实现类

注入时是注入com.service.LogInfoService,为它编写set方法
你注意这句话:name 'logInfo' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values;
是说你的set的参数类型不对

注意看这段错误信息.
Error creating bean with name 'logInfo' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values;
这里不给你翻译了.

<bean id="logInfo" class="com.action.LogAction">
<property name="logInfoService" ref="logInfoService"></property>
</bean>
将以上配置改为
<bean name="logInfo" class="com.action.LogAction">
&