简体   繁体   中英

spring boot switching from in-memory database to persistent database

I have developed my web-application using spring-boot and spring-data-jpa and and in-memory database, and I have a couple questions:

  1. how can i now switch to a persistent, let's say, MySQL database? What do I have to change in my configuration?

  2. Can spring-boot set a database up for me with a specific port and where does it get stored in my file system?

  3. Does IntelliJ provide a datasource browser for the created database?

I am sure this must be covered somewhere in the endless jungle of spring-boot documentation.

  1. You can change the application properties for the datasource according to the link Gabor Bakos already provided.

  2. That depends on the type of the database you want to use. HSQLDB and H2 allow you to specify a file path for the database file, however the database instance itself is still running within your application process. With full RMDBS like MySQL you have to install and configure the MySQL server yourself and provide the connection data to your Spring Boot application.

  3. Yes, IntelliJ has a datasource browser for all major databases (maybe you have to download the database driver).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM