Consider defining a bean of type ‘com.example.springbootdemo.mapper.UserMapper‘ in your configuratio
Posted tfy1332
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Consider defining a bean of type ‘com.example.springbootdemo.mapper.UserMapper‘ in your configuratio相关的知识,希望对你有一定的参考价值。
"C:\\Program Files\\Java\\jdk1.8.0_181\\bin\\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:49658,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" -javaagent:C:\\Users\\Lucas\\AppData\\Local\\JetBrains\\IntelliJIdea2022.3\\captureAgent\\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\charsets.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\deploy.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\access-bridge-64.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\cldrdata.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\dnsns.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\jaccess.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\jfxrt.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\localedata.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\nashorn.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\sunec.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\sunjce_provider.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\sunmscapi.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\sunpkcs11.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\ext\\zipfs.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\javaws.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\jce.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\jfr.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\jfxswt.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\jsse.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\management-agent.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\plugin.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\resources.jar;C:\\Program Files\\Java\\jdk1.8.0_181\\jre\\lib\\rt.jar;C:\\tfy\\code\\springbootDemo\\springbootDemo\\target\\classes;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-data-jdbc\\2.6.11\\spring-boot-starter-data-jdbc-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\data\\spring-data-jdbc\\2.3.6\\spring-data-jdbc-2.3.6.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\data\\spring-data-relational\\2.3.6\\spring-data-relational-2.3.6.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\data\\spring-data-commons\\2.6.6\\spring-data-commons-2.6.6.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-tx\\5.3.22\\spring-tx-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-context\\5.3.22\\spring-context-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-beans\\5.3.22\\spring-beans-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\slf4j\\slf4j-api\\1.7.36\\slf4j-api-1.7.36.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-data-jpa\\2.6.11\\spring-boot-starter-data-jpa-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-aop\\2.6.11\\spring-boot-starter-aop-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-aop\\5.3.22\\spring-aop-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\aspectj\\aspectjweaver\\1.9.7\\aspectjweaver-1.9.7.jar;C:\\Users\\Lucas\\.m2\\repository\\jakarta\\transaction\\jakarta.transaction-api\\1.3.3\\jakarta.transaction-api-1.3.3.jar;C:\\Users\\Lucas\\.m2\\repository\\jakarta\\persistence\\jakarta.persistence-api\\2.2.3\\jakarta.persistence-api-2.2.3.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\hibernate\\hibernate-core\\5.6.10.Final\\hibernate-core-5.6.10.Final.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\jboss\\logging\\jboss-logging\\3.4.3.Final\\jboss-logging-3.4.3.Final.jar;C:\\Users\\Lucas\\.m2\\repository\\net\\bytebuddy\\byte-buddy\\1.11.22\\byte-buddy-1.11.22.jar;C:\\Users\\Lucas\\.m2\\repository\\antlr\\antlr\\2.7.7\\antlr-2.7.7.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\jboss\\jandex\\2.4.2.Final\\jandex-2.4.2.Final.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\fasterxml\\classmate\\1.5.1\\classmate-1.5.1.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\hibernate\\common\\hibernate-commons-annotations\\5.1.2.Final\\hibernate-commons-annotations-5.1.2.Final.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\glassfish\\jaxb\\jaxb-runtime\\2.3.6\\jaxb-runtime-2.3.6.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\glassfish\\jaxb\\txw2\\2.3.6\\txw2-2.3.6.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\sun\\istack\\istack-commons-runtime\\3.0.12\\istack-commons-runtime-3.0.12.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\sun\\activation\\jakarta.activation\\1.2.2\\jakarta.activation-1.2.2.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\data\\spring-data-jpa\\2.6.6\\spring-data-jpa-2.6.6.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-orm\\5.3.22\\spring-orm-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-aspects\\5.3.22\\spring-aspects-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-jdbc\\2.6.11\\spring-boot-starter-jdbc-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter\\2.6.11\\spring-boot-starter-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot\\2.6.11\\spring-boot-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-autoconfigure\\2.6.11\\spring-boot-autoconfigure-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-logging\\2.6.11\\spring-boot-starter-logging-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\ch\\qos\\logback\\logback-classic\\1.2.11\\logback-classic-1.2.11.jar;C:\\Users\\Lucas\\.m2\\repository\\ch\\qos\\logback\\logback-core\\1.2.11\\logback-core-1.2.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\apache\\logging\\log4j\\log4j-to-slf4j\\2.17.2\\log4j-to-slf4j-2.17.2.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\apache\\logging\\log4j\\log4j-api\\2.17.2\\log4j-api-2.17.2.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\slf4j\\jul-to-slf4j\\1.7.36\\jul-to-slf4j-1.7.36.jar;C:\\Users\\Lucas\\.m2\\repository\\jakarta\\annotation\\jakarta.annotation-api\\1.3.5\\jakarta.annotation-api-1.3.5.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\yaml\\snakeyaml\\1.29\\snakeyaml-1.29.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\zaxxer\\HikariCP\\4.0.3\\HikariCP-4.0.3.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-jdbc\\5.3.22\\spring-jdbc-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-thymeleaf\\2.6.11\\spring-boot-starter-thymeleaf-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\thymeleaf\\thymeleaf-spring5\\3.0.15.RELEASE\\thymeleaf-spring5-3.0.15.RELEASE.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\thymeleaf\\thymeleaf\\3.0.15.RELEASE\\thymeleaf-3.0.15.RELEASE.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\attoparser\\attoparser\\2.0.5.RELEASE\\attoparser-2.0.5.RELEASE.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\unbescape\\unbescape\\1.1.6.RELEASE\\unbescape-1.1.6.RELEASE.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\thymeleaf\\extras\\thymeleaf-extras-java8time\\3.0.4.RELEASE\\thymeleaf-extras-java8time-3.0.4.RELEASE.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-web\\2.6.11\\spring-boot-starter-web-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-json\\2.6.11\\spring-boot-starter-json-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-databind\\2.13.3\\jackson-databind-2.13.3.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-annotations\\2.13.3\\jackson-annotations-2.13.3.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\fasterxml\\jackson\\core\\jackson-core\\2.13.3\\jackson-core-2.13.3.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\fasterxml\\jackson\\datatype\\jackson-datatype-jdk8\\2.13.3\\jackson-datatype-jdk8-2.13.3.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\fasterxml\\jackson\\datatype\\jackson-datatype-jsr310\\2.13.3\\jackson-datatype-jsr310-2.13.3.jar;C:\\Users\\Lucas\\.m2\\repository\\com\\fasterxml\\jackson\\module\\jackson-module-parameter-names\\2.13.3\\jackson-module-parameter-names-2.13.3.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\boot\\spring-boot-starter-tomcat\\2.6.11\\spring-boot-starter-tomcat-2.6.11.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\apache\\tomcat\\embed\\tomcat-embed-core\\9.0.65\\tomcat-embed-core-9.0.65.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\apache\\tomcat\\embed\\tomcat-embed-el\\9.0.65\\tomcat-embed-el-9.0.65.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\apache\\tomcat\\embed\\tomcat-embed-websocket\\9.0.65\\tomcat-embed-websocket-9.0.65.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-web\\5.3.22\\spring-web-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-webmvc\\5.3.22\\spring-webmvc-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-expression\\5.3.22\\spring-expression-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\mysql\\mysql-connector-java\\8.0.13\\mysql-connector-java-8.0.13.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\mybatis\\mybatis\\3.2.6\\mybatis-3.2.6.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\mybatis\\mybatis-spring\\1.2.2\\mybatis-spring-1.2.2.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\postgresql\\postgresql\\42.3.6\\postgresql-42.3.6.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\checkerframework\\checker-qual\\3.5.0\\checker-qual-3.5.0.jar;C:\\Users\\Lucas\\.m2\\repository\\jakarta\\xml\\bind\\jakarta.xml.bind-api\\2.3.3\\jakarta.xml.bind-api-2.3.3.jar;C:\\Users\\Lucas\\.m2\\repository\\jakarta\\activation\\jakarta.activation-api\\1.2.2\\jakarta.activation-api-1.2.2.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-core\\5.3.22\\spring-core-5.3.22.jar;C:\\Users\\Lucas\\.m2\\repository\\org\\springframework\\spring-jcl\\5.3.22\\spring-jcl-5.3.22.jar;C:\\Program Files\\JetBrains\\IntelliJ IDEA 2022.3.1\\lib\\idea_rt.jar" com.example.springbootdemo.SpringbootDemoApplication
Connected to the target VM, address: '127.0.0.1:49658', transport: 'socket'
. ____ _ __ _ _
/\\\\ / ___'_ __ _ _(_)_ __ __ _ \\ \\ \\ \\
( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\
\\\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.11)
2023-01-11 09:50:12.735 INFO 91244 --- [ main] c.e.s.SpringbootDemoApplication : Starting SpringbootDemoApplication using Java 1.8.0_181 on DESKTOP-JSP3CM3 with PID 91244 (C:\\tfy\\code\\springbootDemo\\springbootDemo\\target\\classes started by Lucas in C:\\tfy\\code\\springbootDemo\\springbootDemo)
2023-01-11 09:50:12.738 INFO 91244 --- [ main] c.e.s.SpringbootDemoApplication : No active profile set, falling back to 1 default profile: "default"
2023-01-11 09:50:13.260 INFO 91244 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2023-01-11 09:50:13.260 INFO 91244 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
2023-01-11 09:50:13.270 INFO 91244 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 6 ms. Found 0 JDBC repository interfaces.
2023-01-11 09:50:13.276 INFO 91244 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2023-01-11 09:50:13.277 INFO 91244 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-01-11 09:50:13.284 INFO 91244 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 2 ms. Found 0 JPA repository interfaces.
2023-01-11 09:50:13.703 INFO 91244 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-01-11 09:50:13.714 INFO 91244 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-01-11 09:50:13.714 INFO 91244 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2023-01-11 09:50:13.837 INFO 91244 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-01-11 09:50:13.837 INFO 91244 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1063 ms
2023-01-11 09:50:13.956 INFO 91244 --- [ main] com.zaxxer.hikari.HikariDataSource : defaultDataSource - Starting...
2023-01-11 09:50:14.199 INFO 91244 --- [ main] com.zaxxer.hikari.HikariDataSource : defaultDataSource - Start completed.
2023-01-11 09:50:14.281 INFO 91244 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-01-11 09:50:14.323 INFO 91244 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.10.Final
2023-01-11 09:50:14.458 INFO 91244 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations 5.1.2.Final
2023-01-11 09:50:14.545 INFO 91244 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2023-01-11 09:50:14.658 INFO 91244 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2023-01-11 09:50:14.666 INFO 91244 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-01-11 09:50:14.680 WARN 91244 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.example.springbootdemo.mapper.UserMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)
2023-01-11 09:50:14.681 INFO 91244 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2023-01-11 09:50:14.684 INFO 91244 --- [ main] com.zaxxer.hikari.HikariDataSource : defaultDataSource - Shutdown initiated...
2023-01-11 09:50:14.687 INFO 91244 --- [ main] com.zaxxer.hikari.HikariDataSource : defaultDataSource - Shutdown completed.
2023-01-11 09:50:14.689 INFO 91244 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-01-11 09:50:14.699 INFO 91244 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-01-11 09:50:14.722 ERROR 91244 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userMapper in com.example.springbootdemo.service.impl.UserServiceImpl required a bean of type 'com.example.springbootdemo.mapper.UserMapper' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.example.springbootdemo.mapper.UserMapper' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:49658', transport: 'socket'
Process finished with exit code 1
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.example.springbootdemo.mapper.UserMapper" > <select id="selectUserById" parameterType="int" resultType="com.example.springbootdemo.model.User"> select * from yyb where id='03' </select> </mapper>
以上是关于Consider defining a bean of type ‘com.example.springbootdemo.mapper.UserMapper‘ in your configuratio的主要内容,如果未能解决你的问题,请参考以下文章
springboot Consider defining a bean of type 'xxx' in your configuration
Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationMana
Consider defining a bean of type问题解决
MapStruct - Consider defining a bean of type in your configuration.
Consider defining a bean of type `xxx` in your configuration问题解决问题解决
Spring Boot @Autowired无法注入类 Consider defining a bean of type