亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

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 關注
  • 254 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號