springboot同时使用MySQL和mongodb
时间: 2024-02-05 18:04:00
浏览: 149
Spring Boot可以同时使用[mysql](https://geek.csdn.net/educolumn/184b56c51fd333211e6f2a08e35b0efe?spm=1055.2569.3001.10083)和MongoDB数据库。你可以使用Spring Data JPA来访问[mysql](https://geek.csdn.net/educolumn/184b56c51fd333211e6f2a08e35b0efe?spm=1055.2569.3001.10083)数据库,使用Spring Data MongoDB来访问MongoDB数据库。
首先,你需要在pom.xml文件中添加以下[依赖](https://geek.csdn.net/educolumn/251730cd3c2bc47323babd5fc55c308e?spm=1055.2569.3001.10083):
<dependency>
<groupId>[org](https://geek.csdn.net/educolumn/23d0bba68b71e0503af30ae29797603f?spm=1055.2569.3001.10083).springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>[org](https://geek.csdn.net/educolumn/23d0bba68b71e0503af30ae29797603f?spm=1055.2569.3001.10083).springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
```
相关推荐
















