2017-07-30 33 views
0

我是新的春季啓動並嘗試解決這個問題一個星期。 我下載plugin,仍然得到同樣的錯誤,以及工具/選項我沒有代理,如果需要無法執行目標org.springframework.boot:spring-boot-maven-plugin:1.5.6.RELEASE

編輯 我剛剛創建的用戶可以註冊或登錄的基礎工程。我有控制器,服務知識庫,域類。但是當我想檢查我的數據庫是否創建了我得到這個錯誤。我檢查了我的plugins如果我錯過了一些,但一切似乎rigree。你能否給我一些關於什麼是問題的猜測?

我的pom.xml

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.5.6.RELEASE</version> 
    <relativePath/> 
    <!-- lookup parent from repository --> 
</parent> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
    <java.version>1.8</java.version> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>mysql</groupId> 
     <artifactId>mysql-connector-java</artifactId> 
     <scope>runtime</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.eclipse.persistence</groupId> 
     <artifactId>javax.persistence</artifactId> 
     <version>2.1.0</version> 
     <type>jar</type> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-commons</artifactId> 
     <version>1.13.6.RELEASE</version> 
     <type>jar</type> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-jpa</artifactId> 
     <version>1.11.6.RELEASE</version> 
     <type>jar</type> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-maven-plugin</artifactId> 
     <version>1.5.6.RELEASE</version> 
     <type>jar</type> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 

     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
      <version>1.5.6.RELEASE</version> 
      <configuration> 
       <fork>true</fork> 
      </configuration> 
     </plugin> 

    </plugins> 
</build> 

控制檯

說明:

userRepositorycom.example.service.UserService需要一個名爲豆 '的entityManagerFactory',可能不會被發現。

操作:

考慮定義一個配置中的名爲 'entityManagerFactory的' 豆。

+0

u能張貼在引擎收錄,或者你得到確切的錯誤堆棧跟蹤?更重要的是哪些修改後錯誤開始發生? – DevDio

回答

2

嘗試刪除以下

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-maven-plugin</artifactId> 
    <version>1.5.6.RELEASE</version> 
    <type>jar</type> 
</dependency> 

而且

<version>1.5.6.RELEASE</version> 
     <configuration> 
      <fork>true</fork> 
     </configuration> 
+0

我得到的插件jar丟失錯誤 – vusala

+0

重建項目 – Omar

+0

你是什麼意思,但「當我想檢查如果我的數據庫創建我得到這個錯誤」? – Omar

1

您可能需要爲彈簧啓動了Maven插件目標配置,如下面

<executions> 
    <execution> 
     <goals> 
     <goal>repackage</goal> 
     </goals> 
    </execution> 
</executions> 

此外,什麼是你用來構建和運行的maven命令?

+0

不幸的是,仍然得到同樣的錯誤。我只是使用netbeans並運行項目 – vusala

+0

請檢查我的另一個答案可能會幫助你。 –

+0

非常感謝。我會檢查它 – vusala

1

請定義entityMangerFactory bean,並在需要的地方注入它,我想你可能會使用JPA/Hibernate。試試這個

2

在控制器類和用戶服務calss中的UserRepository中自動連接你的UserService。

在UserService類:

@service 
public class UserService{ 

    @Autowired 
    private UserRepository userRepository; 

    .... 
} 

在控制器類:

@Controller 
class UserController{ 

     @Autowired 
     private UserRepository userRepository; 

     ..... 
} 
+0

這並不能解決我的問題 – vusala

相關問題