Spring boot報錯:failed to load applicationcontext

網上多爲解釋Spring對於此報錯的處理,但由於Spring boot多爲自動配置,所以無法參照舊教程解決此問題。

我遇到的情況是,@Query中,命名寫錯導致,

    @Query(value = "select new map(u.id as id, u.name as name) from UserEntity u where u.email like :email")
    public List<Object> findByLikeEmailGetIdAndName(String email);

我寫的是from UserEntity,而實際上,本地僅有User,將@Query進行修改

    @Query(value = "select new map(u.id as id, u.name as name) from User u where u.email like :email")
    public List<Object> findByLikeEmailGetIdAndName(String email);

解決報錯failed to load applicationcontext

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章