为了账号安全,请及时绑定邮箱和手机立即绑定

java.lang.IllegalArgumentException:不是 Spring Boot

java.lang.IllegalArgumentException:不是 Spring Boot

大话西游666 2021-06-07 17:43:50
我的代码中出现以下错误org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为“locationServiceImpl”的 bean 时出错:通过方法“setLocationrepo”参数 0 表示的不满意依赖;嵌套异常是 org.springframework.beans.factory.BeanCreationException:创建名为“locationRepository”的 bean 时出错:调用 init 方法失败;嵌套异常是 java.lang.IllegalArgumentException: Not a managed type: class com.logan.location.entities.Location这是我的存储库界面package com.logan.location.repos;import org.springframework.data.jpa.repository.JpaRepository;import org.springframework.stereotype.Repository;import com.logan.location.entities.Location;@Repositorypublic interface LocationRepository extends JpaRepository<Location, Integer> {}这是我的服务接口package com.logan.location.service;import java.util.List;import org.springframework.stereotype.Service;import com.logan.location.entities.Location;@Servicepublic interface LocationService {    Location saveLocation(Location location);    Location updateLocation(Location location);    void deleteLocation(Location location);    Location getLocationById(int id);    List<Location> getAllLocations();}这是我的 serviceImplpackage com.logan.location.service;import java.util.List;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import com.logan.location.entities.Location;import com.logan.location.repos.LocationRepository;@Servicepublic class LocationServiceImpl implements LocationService {    private LocationRepository locationrepo;    @Autowired    public void setLocationrepo(LocationRepository locationrepo) {        this.locationrepo = locationrepo;    }    public Location saveLocation(Location location) {        // TODO Auto-generated method stub        return locationrepo.save(location);    }    public Location updateLocation(Location location) {        // TODO Auto-generated method stub        return locationrepo.save(location);    }它显示我的位置实体类是非托管的,我尝试了各种答案但它不起作用,有什么帮助吗?
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 236 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信