1
0

feat: 增加mysql作为后端数据库

This commit is contained in:
2024-12-22 12:15:34 +08:00
parent 0052494ec5
commit afb87d0c12
2 changed files with 51 additions and 4 deletions

30
.idea/dataSources.xml generated Normal file
View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="root@192.168.31.127" uuid="f86bcbbe-18d3-4a8a-a9fa-bbc3d8cff468">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://192.168.31.127:3780</jdbc-url>
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="bookstore@192.168.31.127" uuid="ee6ce7f9-27c0-42ef-9a12-73d3f794b526">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://192.168.31.127:3780/bookstore</jdbc-url>
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

View File

@@ -3,12 +3,29 @@ server:
spring: spring:
application: application:
name: bookstore name: bookstore
jpa:
hibernate:
ddl-auto: update
show-sql: true
---
spring:
config:
activate:
on-profile: h2
datasource: datasource:
url: jdbc:h2:file:./database;DB_CLOSE_ON_EXIT=FALSE url: jdbc:h2:file:./database;DB_CLOSE_ON_EXIT=FALSE
driver-class-name: org.h2.Driver driver-class-name: org.h2.Driver
username: lanyuanxiaoyao username: lanyuanxiaoyao
password: lanyuanxiaoyao password: lanyuanxiaoyao
jpa:
hibernate: ---
ddl-auto: update spring:
show-sql: true config:
activate:
on-profile: mysql-local
datasource:
url: jdbc:mysql://192.168.31.127:3780/bookstore
driver-class-name: com.mysql.cj.jdbc.Driver
username: bookstore
password: EzSn+RZ*x2&fHFh9kC+H