'Auditing (@CreatedDate) does not work for WebFlux Spring Boot with reactive MongoDB

Does WebFlux Spring Boot with reactive MongoDB supports Auditing? I tried to use @CreatedDate and it did not work for me. Here is my configuration:

@Configuration
@EnableReactiveMongoRepositories
@EnableMongoAuditing
@AllArgsConstructor
public class ReactiveMongoConfiguration extends AbstractReactiveMongoConfiguration {
    ...
}

Here is my document class

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.domain.Persistable;
import org.springframework.data.mongodb.core.mapping.Document;
...    
import java.util.Date;

@Document
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Message implements Persistable<String> {
  @Id private String id;

  private String text;

  @CreatedDate
  private Date createdDate;

  @Override
  public boolean isNew() {
    return createdDate == null;
  }

Here is Message repository

@Repository
public interface IMessageRepository extends ReactiveMongoRepository<Message, String> {}

When I save message messageRepository.save(message) I always have createdDate=null

Do I miss something or Auditing does not work with reactive MongoDB?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source