SpringBoot-mybatisPlus- error code generator -yaml

SpringBoot integration MyBatis error summary

background:4月5号中午,终于学完了SpringBoot的基本路线!休息几个小时,趁机会把SpringBoot的踩坑出坑记录一下

ps: Great God do not spray


error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'articleServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.xx.blog.mapper.ArticleMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Error scenarios: Use mybatisPlus code generator generates code database reverse. Lead to code error

solution:

Add annotations generated on an interface mapper @Mapper  or add annotations based on the starting  @MapperScan ( "mapper package name")

 

or

 

recommend:

Recommended to add annotations on the startup class SpringBoot of @MapperScan ( "mapper package name") once and for all otherwise need to add annotations @Mapper on all interfaces mapper

 


 

error:

Description:

A component required a bean of type 'com.xx.blog.mapper.ArticleMapper' that could not be found.

Action:

Consider defining a bean of type 'com.xx.blog.mapper.ArticleMapper' in your configuration.

Process finished with exit code 0

Error scenario: Error after error appeared to solve the above, the components need not find "com.xx.blog.mapper.ArticleMapper" type of bean.

solution:

Add annotations in the entity classes generated by the mapper @Repository  will Mapper to Spring Management

 

 


error:

java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml

Error scenario: application.yml is a pit, if the above situation, the general is application.yml this file has a syntax error.

solution:

Notes error cause (application.yml uses # instead of // comments, and # must be followed by a space)

Indent using spaces, do not use tab

Each colon behind must have a space otherwise it will error

 

 

Guess you like

Origin www.cnblogs.com/kkdaj/p/12638909.html