我是新手,正在尝试创建一个 Spring5 MVC/Hibernate5 Web 应用程序,但是当我启动 Tomcat 时出现以下错误:最初的问题与事务管理器有关,在添加事务管理器 bean 定义之前,应用程序启动正常但失败并显示错误消息,指出它无法创建事务线程。org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerController' defined in ServletContext resource [/WEB-INF/spring/store.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy.$Proxy210 implementing com.store.service.CustomerService,java.io.Serializable,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy' to required type 'com.store.service.CustomerServiceImpl' for property 'customerService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'com.sun.proxy.$Proxy210 implementing com.store.service.CustomerService,java.io.Serializable,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised,org.springframework.core.DecoratingProxy' to required type 'com.store.service.CustomerServiceImpl' for property 'customerService': no matching editors or conversion strategy found我的 web.xml :<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"></web-app>
1 回答
aluckdog
TA贡献1847条经验 获得超7个赞
我想在您的CustomerController课程中,您注入的不是接口,而是 的实现CustomerService,如下所示:
public class CustomerController {
@Autowired
private CustomerServiceImpl customerService;
}
具体类是代理的,因此您应该将注入点指定为接口:
public class CustomerController {
@Autowired
private CustomerService customerService;
}
添加回答
举报
0/150
提交
取消