Skip to content

Spring Dependency Injection

Joe Betz edited this page Sep 11, 2013 · 14 revisions

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:

https://github.com/linkedin/rest.li/tree/master/examples/spring-server

To use, first add a dependency to the restli-spring-bridge module, .e.g:


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

Clone this wiki locally