2017-10-28 128 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来管理。