栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

spring boot启动报Error creating bean with name ‘xxx‘:

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

spring boot启动报Error creating bean with name ‘xxx‘:

#spring boot启动报Error creating bean with name ‘xxx’: Injection of resource dependencies failed; nested exception is

##我在启动springboot项目时候保错

由于之前都没有报错,ctrl+v 别人的代码之后,报错的,有Error creating bean with name、空指针等等,网上查了许多都没起作用,然后打断点进行解决的,下面一起看看我的异常。

###1、先看报错的源码
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.github.dreamyoung.mprelation.AutoMapper;

@Configuration
public class AutoMapperConfig {
@Bean
public AutoMapper autoMapper() {
return new AutoMapper(new String[] {“com.jincheng.bean”}); //配置实体类所在目录(可多个,暂时不支持通过符*号配置)
}

}

###2、报错信息
Error creating bean with name ‘webSecurityConfig’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘loginAuthenticationProvider’: Unsatisfied dependency expressed through field ‘userService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘usersServiceImpl’: Unsatisfied dependency expressed through field ‘autoMapper’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘autoMapper’ defined in class path resource [com/xxx/config/AutoMapperConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.dreamyoung.mprelation.AutoMapper]: Factory method ‘autoMapper’ threw exception; nested exception is java.lang.NullPointerException: null
3、最初以为jar包没下载等等,由于多方查证无法解决,只能debugger一步一步查看,最后发现是工作空间多写了一个空格,才出现这样的错
![在这里插入图片描述](https://img-blog.csdnimg.cn/c2c527

以后还得小心点,规范命名。。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/530739.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号