In Springmvc, Global.axas changes, which
1. It turned out to be
public class MvcApplication:System.web.HttpApplication
is now
public class MvcApplication:Spring.web.Mvc.SpringMvcApplication
In Web. config, changes have also occurred:
2.<configuration>
<configSections>
<sectiongroup name= "Spring" >
<section name= "Context" type= "Spring.context.support.mvccontexthandler,spring.web.mvc4" >
</...>
</...>
</...>
3. In the Web. config, you also need to have
<Configuration>
<spring>//and <configsections> Peers
<context>
<resource uri = "File://~/config/BLL.xml" >//here is the configuration of the business logic, because in Controllers.xml,
<resource uri= "File://~/config/controllers.xml" >//here is to let the UI project, there must be a config folder inside, place the Controllers.xml file, to configure the type
</...>
</...>
</...>
4. In <controllers.xml>, configure the Controller
If there is a BLL class attribute in the controller to run the business logic, then the configuration file can be used to replace the BLL class instance, but the attribute must be written as an interface reference
<?xml version= "1.0" encoding= "Utf-8" >
<objects>
<object type= "Class full name, assembly name" singletion= "false" (the default is True, indicates a single column, to be remembered instead of false) >
<property name= "BLL" ref= "XXXBLL"/>//xxxbll points to Bll.xml in XXXBLL
</object>
</...>
4.1 In the Bll.xml
<?xml version= "1.0" encoding= "Utf-8" >
<objects>
<object name= "XXXBLL" Type= "class full name, assembly name" singletion= "false" ></...>
</...>
The effect is that the properties of the BLL class in the controller do not seem to be assigned at all. That Controller.xml,bll.xml,dal.xml, and Global.axas inherited the springmvcapplication synthesis results
Spring is a way to penetrate every level, just not in the UI layer, using
Iapplicationcontext CTX = Contextregistry.getcontext ();
CTx. GetObject () to create the instance.
There is no need to use spring in the UI layer, or the project is expected to be a future business, or the database changes little, can not be used.
Study Notes 42_springmvc