I want to use Odata – Apache Olingo V4 (4.9.0 latest now) in my Spring Boot application (version 3.1.2). It seems Olingo V4 wants javax Servlet instead of Jakarta Servlet in the handler.
What is the solution here?
Tomcat embed core 9.0.x won't work with Spring Boot 3.1.2 either!

I can't downgrade to previous Spring Boot versions. Tried using Tomcat embed core 9.0.73 but that is not compatible with Spring Boot 3.x

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("odata")
public class ODataController {
    
    @Autowired
    CsdlEdmProvider edmProvider;
    
    @Autowired
    EntityCollectionProcessor collectionProcessor;

    @Autowired
    CustomServiceDocumentProcessor customServiceDocumentProcessor;

    @RequestMapping
    public void process1(HttpServletRequest request, HttpServletResponse response) {
        try {
            OData odata = OData.newInstance();
            ServiceMetadata edm = odata.createServiceMetadata(edmProvider,
                    new ArrayList<>());
            ODataHttpHandler handler = odata.createHandler(edm);
            handler.register(collectionProcessor);
            handler.register(customServiceDocumentProcessor);
            request.setAttribute("requestMapping", "/odata");
            handler.process(request, response); // This must be javax.....
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
0

There are 0 best solutions below

Related Questions in JAKARTA-MIGRATION