我在MyBatis-Spring的Mapper生成方面遇到了困难

我在MyBatis的Mapper生成中遇到了困难。

当前的情况/事物

尽管定义了Mapper的接口,但仍然出现以下错误。

2018-11-21 22:08:22.200  WARN 5084 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[~.adapter.customer, ~.port.models]' package. Please check your configuration.

~~~

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-11-21 22:08:25.497 ERROR 5084 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Field customerRecordMapper in ~.adapter.models.customer.CustomerRepositoryAdapter required a bean of type '~.adapter.models.customer.CustomerRecordMapper' that could not be found.


Action:

Consider defining a bean of type '~.adapter.models.customer.CustomerRecordMapper' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:51847', transport: 'socket'

Process finished with exit code 1

环境

使用Maven2的依赖如下:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
    <version>2.0.5.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>1.3.2</version>
</dependency>
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.12</version>
</dependency>

为什么

该类中使用了@Autowired注解的Mapper没有以下的注解。

@MapperScan(basePackages = { "jp.personal.gi.examazon.customerservice.model.adapter.models.customer"})

尽管之前制作的样本没有出错的话应该可以运行…

参考网站

广告
将在 10 秒后关闭
bannerAds