<dependency>
<groupId>com.avides.springboot.springtainer</groupId>
<artifactId>springtainer-mysql</artifactId>
<version>1.4.0</version>
<scope>test</scope>
</dependency>
Properties consumed (in bootstrap.properties
):
embedded.container.mysql.enabled
(default istrue
)embedded.container.mysql.startup-timeout
(default is30
)embedded.container.mysql.docker-image
(default ismysql:8.0.32
)embedded.container.mysql.port
(default is3306
)embedded.container.mysql.root-password
(default isroot
)embedded.container.mysql.database-name
(default isembeddedMySqlDb
)embedded.container.mysql.database-charset
(default isutf8mb4
)
Properties provided (in application-it.properties
):
embedded.container.mysql.url
(an alias forembedded.container.mysql.jdbc-url
)embedded.container.mysql.jdbc-url
embedded.container.mysql.r2dbc-url
embedded.container.mysql.host
embedded.container.mysql.port
Example for minimal configuration in application-it.properties
:
spring.datasource.url=${embedded.container.mysql.url}
spring.datasource.username=root
spring.datasource.password=${embedded.container.mysql.root-password}
To reduce logging insert this into the logback-configuration:
<!-- Springtainer -->
<logger name="com.github.dockerjava.jaxrs" level="WARN" />
<logger name="com.github.dockerjava.core.command" level="WARN" />
<logger name="org.apache.http" level="WARN" />
The container exports multiple labels to analyze running springtainers:
SPRINGTAINER_SERVICE=mysql
SPRINGTAINER_IMAGE=${embedded.container.mysql.docker-image}
SPRINGTAINER_STARTED=$currentTimestamp