Spring Dependency Injection With Rest.li

Spring dependency injection may be used with Rest.li by using the restli-spring-bridge module.

An example project using spring dependency injection is available in the Rest.li codebase:


To use it, first add a dependency to the restli-spring-bridge module, for example:

dependencies {  
compile com.linkedin.pegasus:restli-spring-bridge:1.9.23  

Then, wire in a Rest.li server and a RestliHttpRequestHandler. For an example, see /examples/spring-server/server/src/main/webapp/WEB-INF/beans.xml

Lastly, use Spring’s HttpRequestHandlerServlet to run the RestliHttpRequestHandler as a servlet. For an example, see examples/spring-server/server/src/main/webapp/WEB-INF/web.xml