I have an existing Spring application with my own context that gets bootstrapped from douzens of Spring xml files. A Grizzly web-server is started to publish Soap services.
Now I would like to also serve Rest requests from the same Grizzly. I'm using jersey-spring3 but it starts it's own, separate application context from a required applicationContext.xml.
This is the code that creates the Grizzly HttpServer where Rest and Soap web-services are registered:
//rest services
ResourceConfig resourceConfig = new ResourceConfig(
RestService1.class, //these are
RestService2.class //jersey-spring services
);
HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create("http://localhost:8080/rest"), resourceConfig, false);
//soap services
HttpHandler httpHandler = new JaxwsHandler(mySoapWebService, false);
httpServer.getServerConfiguration().addHttpHandler(httpHandler, myPath);
httpServer.start();
My Rest services (created by the 2nd Spring context) have injection dependencies from the first app context. These injections obviously don't work. Curreetly I'm injecting them myself manually with some hacky code.
What is the correct way to inject Spring services for Rest request handling in an existing application, where jersey re-uses the existing context?