首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

spring 学习一

2013-09-28 
spring 学习11. Spring is lightweight?minimal impact2. Spring DI JavaBeans +interfaces3.JSR-330De

spring 学习1

1. Spring is lightweight=?minimal impact

2. Spring DI= JavaBeans +interfaces3.JSR-330=Dependency Injection for Java4.JSR-303=?Bean Validation API specification?5.
?
@Service("injectCollection") public class CollectionInjection { @Resource(name="map") private Map<String, Object> map; @Resource(name="props") private Properties props; @Resource(name="set") private Set set; @Resource(name="list") private List list; // Other codes omitted } 
?11.Bean Scopes?Singleton:The default singleton scope.?Prototype:A new instance will be created by Spring when requested by application.?Request:For web application use. When using Spring MVC for web application,?beans with request scope will be instantiated for every HTTP request and then?destroyed when the request is completed.?Session:For web application use. When using Spring MVC for web applications,?beans with session scope will be instantiated for every HTTP session and then?destroyed when the session is over.?Global session:For portlet-based web applications. The global session scope beans?can be shared among all portlets withinthe same Spring MVC–powered portal?application.?Thread: A new bean instance will be created by Spring when requested by a new?thread, while for the same thread, the same bean instance will be returned. Note?that this scope is not registered by default.?Custom:Custom bean scope that can be created by implementing the interface?org.springframework.beans.factory.config.Scopeand registering the custom?scope in Spring’s configuration (for XML, use the class org.springframework.beans?.factory.config.CustomScopeConfigurer).?

热点排行