Error creating bean with name ‘userServiceImpl‘: Unsatisfied dependency expressed through field ‘bas

简介: Error creating bean with name ‘userServiceImpl‘: Unsatisfied dependency expressed through field ‘bas
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.tt.sys.model.mapper.UserMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1395) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
  at com.tt.sys.SysApplication.main(SysApplication.java:12) [classes/:na]
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.tt.sys.model.mapper.UserMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1654) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1213) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
  ... 19 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:52305', transport: 'socket'
Process finished with exit code 1


我本地是pom依赖错误导致的:

换成下面一致的即可;

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
<dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.3.2</version>
        </dependency>


如果不行试试这个:

https://blog.csdn.net/qq_42055933/article/details/125687766?spm=1001.2014.3001.5502

相关文章
|
XML 数据格式
解决Unsatisfied dependency expressed through field ‘jdbcTemplate‘;问题~
解决Unsatisfied dependency expressed through field ‘jdbcTemplate‘;问题~
401 0
IDEA添加Swagger2:Parameter 0 of method linkDiscoverers in org. springframework hateoas.config.Hateoasconfiguration required a single bean, but 15 were found:
IDEA添加Swagger2:Parameter 0 of method linkDiscoverers in org. springframework hateoas.config.Hateoasconfiguration required a single bean, but 15 were found
|
3月前
Unsatisfied dependency expressed through field 'restTemplate';
Unsatisfied dependency expressed through field 'restTemplate';
79 0
|
6月前
Unsatisfied dependency expressed through field ‘baseMapper‘
Unsatisfied dependency expressed through field ‘baseMapper‘
42 2
|
6月前
No qualifying bean of type [com.XX.mapper.SysNameMapper ] found for dependency
No qualifying bean of type [com.XX.mapper.SysNameMapper ] found for dependency
91 0
|
Java Linux 程序员
记录:Unsatisfied dependency expressed through field 'XxxService'...【亲测有效】
记录:Unsatisfied dependency expressed through field 'XxxService'...【亲测有效】
1517 1
|
Java 容器 Spring
No qualifying bean of type或Unsatisfied dependency expressed through field ‘XXXService‘或@Autowired 注入
No qualifying bean of type或Unsatisfied dependency expressed through field ‘XXXService‘或@Autowired 注入
151 0
|
Java Spring
BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘ defined in class
BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘ defined in class
176 0
Unsatisfied dependency expressed through field ‘passwordEncoder
Unsatisfied dependency expressed through field ‘passwordEncoder
91 0
Unsatisfied dependency expressed through field ‘passwordEncoder
|
NoSQL Java Redis
Unsatisfied dependency expressed through field /Injection of autowired dependencies failed 解决方法
根据报错的关键字,大底的意思就是依赖方面的问题。
314 0