Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider defining a bean of type 'sample.mybatis.annotation.mapper.CityMapper' in your configuration. #871

Open
baymax55 opened this issue Aug 24, 2023 · 1 comment

Comments

@baymax55
Copy link

baymax55 commented Aug 24, 2023

When I start SampleAnnotationApplication in module mybatis-spring-boot-samples, it shows this error:

D:\devPrograms\jdk\openjdk-18.0.2_windows-x64_bin\jdk-18.0.2\bin\java.exe -XX:TieredStopAtLevel=1 -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:D:\devPrograms\JetBrains\ideaIU-2023.1.win\lib\idea_rt.jar=63800:D:\devPrograms\JetBrains\ideaIU-2023.1.win\bin -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath D:\code\github\spring-boot-starter\mybatis-spring-boot-samples\mybatis-spring-boot-sample-annotation\target\classes;D:\repository\org\springframework\boot\spring-boot-starter\3.1.2\spring-boot-starter-3.1.2.jar;D:\repository\org\springframework\boot\spring-boot\3.1.2\spring-boot-3.1.2.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\3.1.2\spring-boot-autoconfigure-3.1.2.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\3.1.2\spring-boot-starter-logging-3.1.2.jar;D:\repository\ch\qos\logback\logback-classic\1.4.8\logback-classic-1.4.8.jar;D:\repository\ch\qos\logback\logback-core\1.4.8\logback-core-1.4.8.jar;D:\repository\org\apache\logging\log4j\log4j-to-slf4j\2.20.0\log4j-to-slf4j-2.20.0.jar;D:\repository\org\apache\logging\log4j\log4j-api\2.20.0\log4j-api-2.20.0.jar;D:\repository\org\slf4j\jul-to-slf4j\2.0.7\jul-to-slf4j-2.0.7.jar;D:\repository\jakarta\annotation\jakarta.annotation-api\2.1.1\jakarta.annotation-api-2.1.1.jar;D:\repository\org\yaml\snakeyaml\1.33\snakeyaml-1.33.jar;D:\repository\org\springframework\boot\spring-boot-starter-jdbc\3.1.2\spring-boot-starter-jdbc-3.1.2.jar;D:\repository\com\zaxxer\HikariCP\5.0.1\HikariCP-5.0.1.jar;D:\repository\org\springframework\spring-jdbc\6.0.11\spring-jdbc-6.0.11.jar;D:\code\github\spring-boot-starter\mybatis-spring-boot-autoconfigure\target\classes;D:\repository\org\mybatis\mybatis\3.5.13\mybatis-3.5.13.jar;D:\repository\org\mybatis\mybatis-spring\3.0.2\mybatis-spring-3.0.2.jar;D:\repository\com\h2database\h2\2.1.214\h2-2.1.214.jar;D:\repository\org\slf4j\slf4j-api\2.0.7\slf4j-api-2.0.7.jar;D:\repository\org\springframework\spring-core\6.0.11\spring-core-6.0.11.jar;D:\repository\org\springframework\spring-jcl\6.0.11\spring-jcl-6.0.11.jar;D:\repository\org\springframework\spring-tx\6.0.11\spring-tx-6.0.11.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\3.1.2\spring-boot-starter-web-3.1.2.jar;D:\repository\org\springframework\boot\spring-boot-starter-json\3.1.2\spring-boot-starter-json-3.1.2.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.15.2\jackson-databind-2.15.2.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.15.2\jackson-annotations-2.15.2.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.15.2\jackson-core-2.15.2.jar;D:\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.15.2\jackson-datatype-jdk8-2.15.2.jar;D:\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.15.2\jackson-datatype-jsr310-2.15.2.jar;D:\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.15.2\jackson-module-parameter-names-2.15.2.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\3.1.2\spring-boot-starter-tomcat-3.1.2.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\10.1.11\tomcat-embed-core-10.1.11.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\10.1.11\tomcat-embed-el-10.1.11.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\10.1.11\tomcat-embed-websocket-10.1.11.jar;D:\repository\org\springframework\spring-web\6.0.11\spring-web-6.0.11.jar;D:\repository\org\springframework\spring-beans\6.0.11\spring-beans-6.0.11.jar;D:\repository\io\micrometer\micrometer-observation\1.11.2\micrometer-observation-1.11.2.jar;D:\repository\io\micrometer\micrometer-commons\1.11.2\micrometer-commons-1.11.2.jar;D:\repository\org\springframework\spring-webmvc\6.0.11\spring-webmvc-6.0.11.jar;D:\repository\org\springframework\spring-aop\6.0.11\spring-aop-6.0.11.jar;D:\repository\org\springframework\spring-context\6.0.11\spring-context-6.0.11.jar;D:\repository\org\springframework\spring-expression\6.0.11\spring-expression-6.0.11.jar sample.mybatis.annotation.SampleAnnotationApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.2)

2023-08-24T17:45:57.646+08:00  WARN 24380 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sampleAnnotationApplication': Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'sample.mybatis.annotation.mapper.CityMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2023-08-24T17:45:57.695+08:00 ERROR 24380 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in sample.mybatis.annotation.SampleAnnotationApplication required a bean of type 'sample.mybatis.annotation.mapper.CityMapper' that could not be found.


Action:

Consider defining a bean of type 'sample.mybatis.annotation.mapper.CityMapper' in your configuration.


Process finished with exit code 1

@kazuki43zoo
Copy link
Member

@baymax55

I cannot reproduce by only your provided information.
Could you provide more detail information and/or a small reproduce project with GitHub repo or attached file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants