网上多为解释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