我有一个声明为scope =“request”的bean。是否有机会获得该范围内使用的请求?
<bean class="FooRequestAware" scope="request"/>
class FooRequestAware {
private final Request req;
public final bar() {}
}
答案 0 :(得分:2)
是的,只需自动挂载
public class FooRequestAware {
private @Autowired HttpServletRequest req;
public final bar() {}
}