scope-strategy

Dependency Injection in Struts2 Accessing Session Scoped Beans

不打扰是莪最后的温柔 提交于 2019-11-26 13:51:23
Recently I needed to use DI in Struts2. I know it uses it's own DI implementation like Guice but not Guice, as far as I couldn't find some annotations suitable to set the scope for injected beans. To be short, I created a bean //@Repository //@Scope("session") public class Session { private Map<String, Object> map = new HashMap<>(); public Map<String, Object> getMap() { return map; } public void setMap(Map<String, Object> map) { this.map = map; } } I have commented the annotations used with Spring beans. I was successfully created the same bean via spring DI and set the scope in which my

Dependency Injection in Struts2 Accessing Session Scoped Beans

心已入冬 提交于 2019-11-26 03:44:53
问题 Recently I needed to use DI in Struts2. I know it uses it\'s own DI implementation like Guice but not Guice, as far as I couldn\'t find some annotations suitable to set the scope for injected beans. To be short, I created a bean //@Repository //@Scope(\"session\") public class Session { private Map<String, Object> map = new HashMap<>(); public Map<String, Object> getMap() { return map; } public void setMap(Map<String, Object> map) { this.map = map; } } I have commented the annotations used