Struts 2 bean configuration default scope

筅森魡賤 提交于 2019-12-07 23:58:30

问题


I'm trying to use basic DI with Struts2 using the configuration file as described here.

However, I was not able to find what the default scope is for injecting a bean.

I know that the default scope is Singleton for Spring but I didn't want to assume the same with Struts2.

Any ideas?


回答1:


The default scope is singleton, but there's a scope with name default which is different. May be this question let you better understand scopes in Struts2. The framework support scopes like singleton, default, and thread other scopes you should implement manually.

Look at the source code where the scopes are defined.

To clarify the scope named default means a one instance per injection. You can find this in comments to Scope.DEFAULT.



来源:https://stackoverflow.com/questions/20456981/struts-2-bean-configuration-default-scope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!