2017-10-28 174 views
0

我們有Spring應用程序的休息控制器。我們在Spring Boot 1.5.8上運行。我們需要添加MySQL數據庫連接器和所有必需的依賴關係。這是我們目前的pom.xml。我們嘗試了很多方法,但都沒有成功我們已經嘗試在mvndependencies.com上添加依賴關係。以及完成項目並從中複製依賴關係。Maven的依賴SpringBoot和MySQL

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.5.8.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-cache</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-websocket</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.postgresql</groupId> 
     <artifactId>postgresql</artifactId> 
     <scope>runtime</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-configuration-processor</artifactId> 
     <optional>true</optional> 
    </dependency> 
    <dependency> 
     <groupId>com.nimbusds</groupId> 
     <artifactId>nimbus-jose-jwt</artifactId> 
     <version>5.1</version> 
    </dependency> 
    <dependency> 
     <groupId>com.github.scribejava</groupId> 
     <artifactId>scribejava-apis</artifactId> 
     <version>4.2.0</version> 
    </dependency> 

</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
     </plugin> 
    </plugins> 
</build> 

在此先感謝

+0

你面對什麼問題?任何錯誤消息? – Vasan

回答

0

如果你想要使用Spring引導數據,您需要:

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-data-jpa</artifactId> 
</dependency> 

如果你想添加MySQL的支持,你需要的唯一依賴是MySQL驅動程序:

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

這兩個依賴項的版本都應該由spring boot來管理。