Spring Security(Third Edition)
上QQ阅读APP看书,第一时间看更新

Updating our dependencies

We have already included all of the dependencies you need for this chapter, so you will not need to make any updates to your build.gradle file. However, if you are just adding Spring Data JPA support to your own application, you will need to add spring-boot-starter-data-jpa as a dependency in the build.gradle file, as follows:

    //build.gradle
// JPA / ORM / Hibernate:
//compile('org.springframework.boot:spring-boot-starter-data-jpa')
// H2 RDBMS
//runtime('com.h2database:h2')
// MongoDB:

compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('de.flapdoodle.embed:de.flapdoodle.embed.mongo')

Notice we removed the spring-boot-starter-jpa dependency. The spring-boot-starter-data-mongodb dependency will contain all the dependencies needed to wire our domain objects to our embedded MongoDB database, with a mix of Spring and MongoDB annotations.

We also added the Flapdoodle embedded MongoDB database, but this is only meant for testing and demonstration purposes. Embedded MongoDB will provide a platform neutral way for running MongoDB in unit tests. This embedded database is located at https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.