Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Configuration
- public class AppConfiguration {
- @Autowired
- private EventStore eventStore;
- @Autowired
- private Serializer serializer;
- @Autowired
- private EntityManager entityManager;
- @Bean
- public AggregateFactory<Account> aggregateFactory(){
- return new GenericAggregateFactory<Account>(Account.class);
- }
- @Bean
- public EventCountSnapshotTriggerDefinition countSnapshotTriggerDefinition(){
- return new EventCountSnapshotTriggerDefinition(snapShotter(), 3);
- }
- @Bean
- public Snapshotter snapShotter(){
- return new AggregateSnapshotter(eventStore, aggregateFactory());
- }
- @Bean
- public EventSourcingRepository<Account> accountRepository(){
- return new EventSourcingRepository<>(aggregateFactory(), eventStore, countSnapshotTriggerDefinition());
- }
- public JpaTokenStore tokenStore(){
- return new JpaTokenStore(new SimpleEntityManagerProvider(entityManager), serializer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement