I am building a Spring Boot API for a tree structure that supports multiple storage implementations (memory, PostgreSQL and MongoDB ). The storage implementation is selected using properties like: properties app.storage=postgres or: app.storage=mongo API Endpoint The endpoint for creating child nodes is: POST /nodes/{parentId}/children The controller receives the parent ID as Long : @Override public NodeResponse nodesParentIdChildrenPost(Long parentId, NodeRequest nodeRequest) { Object child = persistenceService.addChild(parentId, nodeRequest.getName()); return toNodeResponse(child); } Postgre