<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
<version>9.1.6</version>
</dependency>
[환경]
SpringBoot 2.7.3
Mysql 8.0.29-arm64
SpringBoot에서 MySQL과 Flyway를 사용하기 위해 의존성을 추가했다.
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>9.1.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.29</version>
</dependency>
PostgreSQL을 사용할때는 flyway-core만으로도 실행이 가능했지만 MySQL을 사용할 때는 다음과 같은 오류와 함께 실행이 되지 않는다.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Unsupported Database: MySQL 8.0
Mysql을 사용하는 경우 아래 의존성을 추가해줘야한다.
<!-- https://mvnrepository.com/artifact/org.flywaydb/flyway-mysql -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
<version>9.1.6</version>
</dependency>
Reference
https://stackoverflow.com/questions/72711770/flyway-unsupported-database-mysql-8-0
https://flywaydb.org/documentation/database/mysql#java-usage
'🌱 Spring' 카테고리의 다른 글
Spring Security RoleHierarchy 미적용 이슈 (0) | 2022.12.26 |
---|---|
java.lang.NullPointerException: null at springfox.documentation.spring.web.WebMvcPatternsRequestConditionWrapper.getPatterns(WebMvcPatternsRequestConditionWrapper.java:56) (0) | 2022.10.09 |
@Value annotation 사용 간 유의사항 (0) | 2022.07.05 |
com.google.gson.stream.MalformedJsonException (0) | 2021.10.17 |
org.apache.el.parser.ParseException (1) | 2020.03.28 |