天天看点

guns 异常:No unique bean of type [javax.persistence.EntityManagerFactory] is defined

当遇到这个问题时,一般上网百度都是说配置文件写错了,可是guns的配置文件我基本没有动过,所以我排除配置文件中的错误

每次遇到这个问题我都是重新下载guns源码。将旧代码拷入到新创建的guns项目中去才得以问题迅速解决。

偶尔中我发现当我修改新guns pom中内容时报了这个错,所以我猜测是旧项目中guns pom 中出现了依赖错误,然而经过我尝试确实是这样,便是由下面依赖导致的:

<dependency>

<groupId>org.mybatis.spring.boot</groupId>

<artifactId>mybatis-spring-boot-starter</artifactId>

<version>1.3.1</version>

</dependency>

<dependency>

<groupId>tk.mybatis</groupId>

<artifactId>mapper-spring-boot-starter</artifactId>

<version>1.2.4</version>

</dependency>

<dependency>

<groupId>com.github.pagehelper</groupId>

<artifactId>pagehelper-spring-boot-starter</artifactId>

<version>1.2.3</version>

</dependency>

继续阅读