Код: Выделить всё
Caused by: java.net.ConnectException: Connection refused (Connection refused)
springboot-container | at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) \~\[na:na\]
Код: Выделить всё
version: '3.8'
services:
mysql:
image: mysql:latest
container_name: new-mysql-container
ports:
- "3307:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: employee_management_system4
MYSQL_USER: root
MYSQL_PASSWORD: root
volumes:
- mysql_data:/var/lib/mysql
springboot-app:
image: invoice-system:1.0 # Use the invoice-system:1.0 image
container_name: springboot-container
ports:
- "8080:8080"
depends_on:
- mysql
volumes:
- ./target/springboot-invoice-system-0.0.1-SNAPSHOT.jar:/app/app.jar
volumes:
mysql_data:
# For local
spring.datasource.url = jdbc:mysql://mysql-db/employee_management_system4?serverTimezone=UTC
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto = update
spring.servlet.multipart.max-file-size = 10MB
spring.servlet.multipart.max-request-size = 10MB
spring.mvc.contentnegotiation.favor-parameter = true
spring.mvc.contentnegotiation.media-types.pdf = application/pdf
spring.mvc.contentnegotiation.media-types.xlsx = application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
spring.mvc.contentnegotiation.media-types.csv = text/csv
spring.mvc.contentnegotiation.media-types.xml = application/xml
spring.mvc.contentnegotiation.media-types.json = application/json
server.port = ${PORT:8080}
Подробнее здесь: https://stackoverflow.com/questions/783 ... l-database