I have a below project structure
API
microstream:
rest:
enabled: true
storage:
order:
root-class: 'fete.bird.entity.RootContainer'
storage-directory: 'api/build/order-storage'
Infrastructure
@Singleton
public class OrderRepository implements IOrderRepository {
private final RootProvider<RootContainer> rootProvider;
public OrderRepository(RootProvider<RootContainer> rootProvider) {
this.rootProvider = rootProvider;
}
@Override
public Order create(Order order) {
Map<UUID, Order> root = rootProvider.root().getOrders();
root.put(order.id(), order);
return order;
}
}
Core
@Introspected
public interface IOrderRepository {
Order create(Order order);
}
Controller
@Controller("/order")
public class OrderController {
private final IOrderRepository iOrderRepository;
public OrderController(IOrderRepository iOrderRepository) {
this.iOrderRepository = iOrderRepository;
}
@Post
public Order post(Order model) {
var result =iOrderRepository.create(model);
return result;
}
}
The data is not persisted when I stop the application and rerun it again, an empty map is loaded, it is not persisting the old data. A sample application https://github.com/anandjaisy/microstream-micronaut-issue

Here are some issues that I found in your example project.
API Module
Controller
Unrelated to your question but I recommend to use
@Bodyin your controller method, in order to tell Micronaut how to map the request payload.Order record
Convert your Java record to a POJO since Microstream has issues with records (see https://docs.microstream.one/manual/storage/faq/java-features.html)
Infrastructure Module
That module is not configured properly. No Micronaut compile-time processors are registered since you are not using the Micronauts Gradle plugin in that module. The
OrderRepositoryis using theStoreParamsannotation. This has only an effect when Micronaut preprocesses your code at compile time and generates additional code.Therefore you need to extend the
build.gradleby registering the Micronautio.micronaut.libraryplugin.Configuration
In your
application.ymlyou are defining the storageorderbut in the repository implementation you are referring toorders.