【发布时间】:2020-04-02 10:54:02
【问题描述】:
**Wild Fly 服务器日志 :: ** org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为“customerController”的bean时出错:通过字段“customerService”表示不满足的依赖关系; 引起:java.lang.RuntimeException:org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为“customerController”的bean时出错:通过字段“customerService”表示的依赖关系不满足;嵌套异常是 org.springframework.beans.factory.NoSuchBeanDefinitionException: Spring服务实现代码::
package com.edifixio.training.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.edifixio.training.dao.CustomerDAO;
import com.edifixio.training.entity.Customer;
@Service
public class CustomerServiceImpl {
@Autowired
private CustomerDAO customerDAO;
@Transactional
public List < Customer > getCustomers() {
return customerDAO.getCustomers();
}
@Transactional
public void saveCustomer(Customer theCustomer) {
customerDAO.saveCustomer(theCustomer);
}
@Transactional
public Customer getCustomer(int theId) {
return customerDAO.getCustomer(theId);
}
@Transactional
public void deleteCustomer(int theId) {
customerDAO.deleteCustomer(theId);
}
}
【问题讨论】:
-
把代码提供给服务很好,但是没有注入的代码,可能很难帮你。
标签: java spring spring-mvc spring-data-jpa spring-jdbc