Things are a little bit more complicated here. Let me explain. If you take a look at the web.xml file, you’ll find that requests to the /rest URLs are served by a separate dispatcher servlet:
This servlet uses a separate Spring context. Configuration files for the REST spring context are defined by the
cuba.restSpringContextConfig application property. So you may do the following:
- Override the controller manager class in the web module.
- create new
rest-web-spring.xml file with the overrriden bean defintiion in the web module
- register the
rest-web-spring.xml file in the web-app.properties file:
cuba.restSpringContextConfig = +com/company/resttest/rest-web-spring.xml
After that your version of the controller manager will be registered in the same spring context as other REST-releated spring beans.