VaughnVernon / IDDD_Samples

These are the sample Bounded Contexts from the book "Implementing Domain-Driven Design" by Vaughn Vernon: http://vaughnvernon.co/?page_id=168
Other
3.77k stars 906 forks source link

Can't enable Mysql in EventStoreProvider #33

Open xxRockOnxx opened 5 years ago

xxRockOnxx commented 5 years ago

I tried setting FOR_MYSQL to true and FOR_LEVELDB to false but the test would not proceed because of null exception.

If you trace these lines:

The instance is not initialized.

I tried putting mysqlJdbcEventStore before followStoreEventDispatcher in applicationContext-collaboration.xml so that the mysql is initialized first but it's not working also.

I am not a java guy so I dont actually know what's happening.

I would like to try MySQL instead of LevelDB.

xxRockOnxx commented 5 years ago

I managed to find a solution but again however, I am not a java guy. In the applicationContext-collaboration.xml, I added an attribute to some beans:

<bean id="forumRepository" class="com.saasovation.collaboration.port.adapter.persistence.repository.EventStoreForumRepository" depends-on="mysqlJdbcEventStore" />

<bean id="mysqlJdbcEventStore" class="com.saasovation.common.port.adapter.persistence.eventsourcing.mysql.MySQLJDBCEventStore" depends-on="collaborationDataSource" >

Good thing the Spring used here is v3 which is when the depends-on attribute becomes available according to: https://stackoverflow.com/a/7868418/10975709