1 |
41049
|
nikon.gasp
|
package eu.dnetlib.repo.manager.server.services;
|
2 |
40265
|
nikon.gasp
|
|
3 |
|
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
4 |
|
|
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
5 |
|
|
import org.springframework.web.context.WebApplicationContext;
|
6 |
|
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
7 |
|
|
|
8 |
|
|
import javax.servlet.ServletException;
|
9 |
|
|
|
10 |
|
|
/**
|
11 |
|
|
* Created by nikonas on 8/12/15.
|
12 |
|
|
*/
|
13 |
|
|
public abstract class AutowiringRemoteServiceServlet extends RemoteServiceServlet {
|
14 |
|
|
@Override
|
15 |
|
|
public void init() throws ServletException {
|
16 |
|
|
super.init();
|
17 |
|
|
|
18 |
|
|
final WebApplicationContext ctx =
|
19 |
|
|
WebApplicationContextUtils.getWebApplicationContext(getServletContext());
|
20 |
|
|
|
21 |
|
|
if (ctx == null) {
|
22 |
|
|
throw new IllegalStateException("No Spring web application context found");
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
ctx.getAutowireCapableBeanFactory().autowireBeanProperties(this,
|
26 |
|
|
AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true);
|
27 |
|
|
}
|
28 |
|
|
}
|