Hi, I am using axon version3.0-M5. while calling repository.load, it showing “no unity of work found”. The following is my configuration. Could you please help me.
@EnableAxonAutoConfiguration
@SpringBootApplication
public class BookCqrsApplication {
public static void main(String[] args) {
SpringApplication.run(BookCqrsApplication.class, args);
}
@Bean
public EventStorageEngine eventStorageEngine() {
return new InMemoryEventStorageEngine();
}
@Bean
public Repository jpaRepo(EventBus eventBus) {
return new GenericJpaRepository<>(entityManagerProvider(), Book.class, eventBus);
}
@Bean
public EntityManagerProvider entityManagerProvider() {
return new ContainerManagedEntityManagerProvider();
}
@PersistenceUnit
private EntityManagerFactory entityManagerFactory;
@Autowired
private SpringTransactionManager springTransactionManager;
@Bean
public SpringTransactionManager springTransactionManager() throws Exception {
return new SpringTransactionManager(transactionManager());
}
@Bean
public PlatformTransactionManager transactionManager() throws PropertyVetoException {
return new JpaTransactionManager(entityManagerFactory);
}
@Bean
public TransactionManagerFactoryBean transactionManagerFactoryBean() throws PropertyVetoException {
TransactionManagerFactoryBean factoryBean = new TransactionManagerFactoryBean();
factoryBean.setTransactionManager(transactionManager());
return factoryBean;
}
}