我是新手,正在嘗試創(chuàng)建一個 Spring5 MVC/Hibernate5 Web 應(yīng)用程序,但是當我啟動 Tomcat 時出現(xiàn)以下錯誤:最初的問題與事務(wù)管理器有關(guān),在添加事務(wù)管理器 bean 定義之前,應(yīng)用程序啟動正常但失敗并顯示錯誤消息,指出它無法創(chuàng)建事務(wù)線程。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條經(jīng)驗 獲得超7個贊
我想在您的CustomerController課程中,您注入的不是接口,而是 的實現(xiàn)CustomerService,如下所示:
public class CustomerController {
@Autowired
private CustomerServiceImpl customerService;
}
具體類是代理的,因此您應(yīng)該將注入點指定為接口:
public class CustomerController {
@Autowired
private CustomerService customerService;
}
添加回答
舉報
0/150
提交
取消