Spring Semum Development Simple Practice

xiaoxiao2021-03-06  39

Spring Semum Development

Background We generally use Spring Struts iBATIS development model, using the Spring Standards Business Bean, when the project is large, face a bean naming conflict problem, if the Struts is the way, different modules have their own name Space, will avoid a problem with a resection of a BEAN configuration file when several parallel developed subsystems or modules is shared.

Simple Program The public bean, such as data sources, transaction management, ibatis or hibernate, an international resource file, etc. Here, you can see the elaborate scalability in Spring, and the constructor of ApplicationContext allows you to create through a parent instance. Core classes ContextHelper, manager class as follows: public class ContextHelper {private static Map _contexts; private static ApplicationContext _rootContext; private static final String ROOT_CONTEXT = "conf / rootContext.xml"; static {_contexts = new HashMap (); try { _rootcontext = new classpathXMLApplicationContext (root_context);} catch (exception e) {throw new contexception (e);}}

转载请注明原文地址:https://www.9cbs.com/read-75732.html

New Post(0)