在springBoot中同时使用mysql和MongoDB

在SpringBoot中非关系向数据库MongoDB和关系型数据库MySQL都可通过引入相关依赖并按照指定配置单独集成;

mysql引入依赖:

compile "org.springframework.boot:spring-boot-starter-web:1.5.18.RELEASE"
 compile "org.springframework.boot:spring-boot-starter-jdbc:1.5.18.RELEASE"
compile 'mysql:mysql-connector-java'

mongo引入依赖

compile "org.springframework.boot:spring-boot-starter-web:1.5.18.RELEASE"
compile "org.springframework.boot:spring-boot-starter-data-mongodb:1.5.18.RELEASE"

同时使用:

第一种方式:

  • 同时引入以上依赖
compile 

猜你喜欢

转载自blog.csdn.net/weixin_42551921/article/details/134501323