spring-projects / spring-modulith

Modular applications with Spring Boot
https://spring.io/projects/spring-modulith
Apache License 2.0
779 stars 129 forks source link

Add support for MariaDB database driver #836

Closed Fezlight closed 4 days ago

Fezlight commented 6 days ago

Do you have any information about support for MariaDB database through it's dedicated driver "org.mariadb.jdbc:mariadb-java-client" ?

 Caused by: java.lang.IllegalArgumentException: Unsupported database type: MariaDB
    at org.springframework.modulith.events.jdbc.DatabaseType.lambda$from$1(DatabaseType.java:54)
    at java.base/java.util.Optional.orElseThrow(Optional.java:403)
    at org.springframework.modulith.events.jdbc.DatabaseType.from(DatabaseType.java:54)
    at org.springframework.modulith.events.jdbc.JdbcEventPublicationAutoConfiguration.databaseType(JdbcEventPublicationAutoConfiguration.java:45)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146)
    ... 85 common frames omitted

As an alternative, because MariaDB works like MySQL we can switch to the MySQL driver if version under 11.X but we loose some specific feature added by driver itself.

odrotbohm commented 5 days ago

We can, of course, add support for that. If you'd like to help, do you think could duplicate the MYSQL enum value in DatabaseType and create copies of the MySQL-related tests and schema files? Given the similar nature of Maria with MySQL, I don't think any further adjustments should be necessary.

Fezlight commented 5 days ago

Yes, I think duplicating the value of the enum is enough, as both work in the same way. I can do a PR when i got some time.

Fezlight commented 5 days ago

I finally opened the pull request :) #839

odrotbohm commented 4 days ago

You apparently found time pretty quickly! 🙃 Merged, thanks!