patka / cassandra-migration

Schema migration library for Cassandra
MIT License
152 stars 47 forks source link

Synchronization with spring boot #82

Closed dzasti closed 10 months ago

dzasti commented 11 months ago

I recently configured the library in my Spring Boot project and have two questions:

  1. Is Cassandra migration supposed to throw an exception on an invalid migration and not stop the app from running?
  2. Other beans are initialized before ending the migration scripts, is it on purpose or my local problem?
patka commented 11 months ago

Hi, Let me try to answer your questions: 1) if there is a problem with a migration, Cassandra migration will throw an exception. The normal behavior with Spring, as far as I know, is that the dependency injection container is stopped. If, however, you are executing your spring application inside a web container, it is possible that the application is stopped but your web container (Tomcat, Jetty, etc) keeps running since there could potentially be other applications running in the same container that should not be interrupted by faulty apps. 2) if you have other beans that depend on Cassandra migration to be done you need to declare an explicit dependency on it. There is a property called CASSANDRA_MIGRATION_BEAN_NAME on the CassandraMigrationAutoConfiguration in the spring boot package. If you depend on this one, your bean will only be instantiated after the migration has been done.

Let me know if that helps.

Cheers Patrick

patka commented 10 months ago

Closing this as there was no further reply, so I assume the issue is solved.