Заменил используемую СУБД Postgres на MySQL
https://spring.io/guides/gs/accessing-data-mysql
This commit is contained in:
17
compose.yml
17
compose.yml
@@ -1,10 +1,11 @@
|
||||
services:
|
||||
postgres:
|
||||
restart: on-failure
|
||||
image: postgres:13
|
||||
ports:
|
||||
- "5454:5432"
|
||||
mysql:
|
||||
image: 'mysql:latest'
|
||||
environment:
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: 123456
|
||||
POSTGRES_DB: sweater_db
|
||||
- 'MYSQL_DATABASE=sweater_db'
|
||||
- 'MYSQL_PASSWORD=123456'
|
||||
- 'MYSQL_ROOT_PASSWORD=verysecret'
|
||||
- 'MYSQL_USER=user'
|
||||
ports:
|
||||
- '3306'
|
||||
|
||||
|
||||
8
pom.xml
8
pom.xml
@@ -26,12 +26,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mustache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
@@ -43,7 +41,6 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
@@ -55,8 +52,8 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -69,5 +66,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5454/sweater_db
|
||||
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/sweater_db
|
||||
spring.datasource.username=user
|
||||
spring.datasource.password=123456
|
||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||
spring.jpa.show-sql: true
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
|
||||
Reference in New Issue
Block a user