Reputation:
I wanted to ask why does this code throw error with 2.3.0.RELEASE
and not with 2.0.6.RELEASE
of Spring Data MongoDB:
@Service
public class ServiceX {
@Autowired private MongoTemplate mongoTemplate;
@Scheduled(fixedDelay = 1000) public void scheduled() {
// I am using mongoTemplate here
}
}
Upvotes: 2
Views: 2610
Reputation: 12937
MongoTemplate
is an imperative variant. You should use ReactiveMongoTemplate
instead since you are on Reactive MongoDB. It used to work in older versions but it won't work with Spring Boot 2.3.0.RELASE
and above.
Infact, I created this issue yesterday:
You can always switch to non reactive variant of Spring Data MongoDB using spring-boot-starter-data-mongodb
instead of spring-boot-starter-data-mongodb-reactive
.
Upvotes: 4