spring boot return 201 created

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/resource")
public class MyController {

    @PostMapping("/create")
    public ResponseEntity<String> createResource(@RequestBody String requestPayload) {
        // Validate requestPayload if needed

        // Process the requestPayload to create a resource

        // Return a ResponseEntity with HTTP status 201 Created and a response body
        return ResponseEntity.status(HttpStatus.CREATED).body("Resource created successfully");
    }
}