0

I am developing Spring Boot + AXON example from the link: https://blog.novatec-gmbh.de/event-sourcing-spring-boot-axon/ and just updated Spring Boot version 2.1.0.RELEASE.

Multiple markers at this line - The type DefaultMongoTemplate is deprecated - The constructor DefaultMongoTemplate(MongoClient) is deprecated

Code

import com.mongodb.MongoClient;
import org.axonframework.eventsourcing.eventstore.EventStorageEngine;
import org.axonframework.mongo.eventsourcing.eventstore.DefaultMongoTemplate;
import org.axonframework.mongo.eventsourcing.eventstore.MongoEventStorageEngine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AggregateConfig {
    @Bean
    public EventStorageEngine eventStore(MongoClient client) {
        return new MongoEventStorageEngine(new DefaultMongoTemplate(client));
    }

}

Looks like DefaultMongoTemplate code is deprecated, what's the replacement for it ?

enter image description here

PAA
  • 1
  • 46
  • 174
  • 282

1 Answers1

0

As off Axon release 4.0, extension package, like Mongo, have been moved to a dedicated repository (which you can find here). Additionally, when upgraded from Axon 3.x to 4.0, we have replaced several constructors on the infrastructure components in favor of the Builder pattern. One of these which has undergone that change, is the DefaultMongoTemplate.

A part from that story though, I just checked out Axon 3.x (as I assume you're not looking at 4.0 at the moment), and the org.axonframework.mongo.eventhandling.saga.repository.DefaultMongoTemplate is deprecated in favor of the org.axonframework.mongo.DefaultMongoTemplate. I pull this from the javadoc at the moment, so I had hoped that would be visible on your side.

Any how, I hope this helps you out! And if you've got the change, I'd recommend to upgrade to Axon 4.x, as new features will get added in that version instead of version 3.x.

Steven
  • 6,936
  • 1
  • 16
  • 31