当前位置: 首页 > 知识库问答 >
问题:

创建名称为'clienteRestController'的bean时出错:通过字段'clientService'表示的不满意依赖项;

居星阑
2023-03-14

创建名称为clienteRestController的bean时出错:通过字段clientService表示的不满意的依赖项。

创建名称为'clientServiceImpl'的bean时出错:通过字段'client道'表示的不满意的依赖项。

创建名称为ICliente道的bean时出错:初始化方法调用失败。

嵌套异常java.lang.IllegalArgumentExcishop:不是托管类型:类java.lang.包

我正在使用eclipse和MySQL数据库spring boot项目,当我运行该项目时,我看到了这个错误,我看到了堆栈溢出中的一些解决方案,但没有成功,任何人都可以帮助,谢谢

@Entity
@Table(name = "package")
public class Package implements Serializable{

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private String name;

private int count;

@Column(precision=18, scale=2) /** Number (16, 2) **/
private double price;

@Column(name = "createAt")
@Temporal(TemporalType.TIMESTAMP)
private Date createAt;


public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public int getCount() {
    return count;
}
public void setCount(int count) {
    this.count = count;
}
public double getPrice() {
    return price;
}

public void setPrice(double price) {
    this.price = price;
}
public Date getCreateAt() {
    return createAt;
}
public void setCreateAt(Date createAt) {
    this.createAt = createAt;
}
private static final long serialVersionUID = 1L;

}

控制器“ClientRestController”:

@CrossOrigin(origins = {"http://localhost:4200"})
@RestController
@RequestMapping("/apiHorsesClub")
public class ClienteRestController {

@Autowired
private IClienteService clientService;

@GetMapping("clients")
public List<Package> index()
{
    return clientService.findAll();
}

}

DAO层“客户端DAO”:

public interface IClienteDao extends CrudRepository<Package, Long>{
}

服务层“IClientService”:公共接口IClientService{

public List<Package> findAll();

}

实现服务“ClientServiceImpl”:

@Service
public class ClientServiceImpl implements IClienteService {

@Autowired
private IClienteDao clientDao;

@Override
@Transactional(readOnly = true)
public List<Package> findAll() {
    return (List<Package>) clientDao.findAll();
}

}

暂时还没有答案

 类似资料: