How can I set up a bean which will created once per request.
I Tried to do like this :
@Component
@Scope(value = "request")
public class TestBean {
@PostConstruct
public void init() {
System.out.println("start request");
}
@PreDestroy
public void onDestroy() {
System.out.println("ends request");
}
}
Thanks.
Try this
@Scope(value="request", proxyMode= ScopedProxyMode.TARGET_CLASS)
For more details see this blog post.