天天看點

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>

繼續閱讀