Spring.net 在aps.net Web的配置复习

1.引入程序集Spring.Core,CommonLogging,Spring.Web

2.Web.Config的配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="spring">
      <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
      <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
    </sectionGroup>
    
  </configSections>
  <spring>
    <context>
      <resource uri="config://spring/objects"/>
      <resource uri="~/Config/BLL.xml"/>
    </context>
    <objects xmlns="http://www.springframework.net">
      <object id="student" type="WebApplication5.Student, WebApplication5">
      </object>
    </objects>
  </spring>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
      <httpHandlers>
        
      </httpHandlers>
    </system.web>
  <system.webServer>
    <modules>
      <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
    </modules>
    <handlers>
      <add name="handle1" verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
    </handlers>
    <directoryBrowse enabled="true"/>
    
  </system.webServer>
</configuration>
3. 客户端调用部分

IApplicationContext ctx = ContextRegistry.GetContext();
            Student  stu=ctx["Student"] as Student;
            stu.SayHello();

时间: 2024-08-04 01:30:47

Spring.net 在aps.net Web的配置复习的相关文章

Spring MVC 搭建过程中web.xml配置引入文件的路径问题

为啥要说一下这么low的问题,因为我是一个比较low的人,哈哈.本来我技术有限,没事干自己撘个环境找找乐趣,结果被各种基础问题,弄的一脸蒙蔽.算了不多说,直接说问题. 1.首先说一下java编译后的文件,正常来说我们编写的文件一般都是java文件,但实际上eclipse会帮我们编译成.class文件(在project下有个自动编译),没有编译的话,Project->Build Project 来编译当前的项目 2.上面说的都是很简单的事情,但是简单的再延伸,就可能出一点问题了,重申一下,我比较l

Spring MVC的web.xml配置详解(转)

出处http://blog.csdn.net/u010796790 1.spring 框架解决字符串编码问题:过滤器 CharacterEncodingFilter(filter-name) 2.在web.xml配置监听器ContextLoaderListener(listener-class) ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息.因为它实现了ServletContextListener这个接口,在web.

基于注解的Spring MVC(所需jar包,web.xml配置,Spring文件配置,@Controller,@RequestMapping,@RequestParam,model填參,EL取值)

1.加入jar 2.web.xml配置: <?xml version="1.0" encoding="UTF-8"? > <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocati

web.xml 配置Spring 与 struts

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee htt

spring mvc 中web.xml配置信息解释

在项目中总会遇到一些关于加载的优先级问题,近期也同样遇到过类似的,所以自己查找资料总结了下,下面有些是转载其他人的,毕竟人家写的不错,自己也就不重复造轮子了,只是略加点了自己的修饰. 首先可以肯定的是,加载顺序与它们在 web.xml 文件中的先后顺序无关.即不会因为 filter 写在 listener 的前面而会先加载 filter.最终得出的结论是:listener -> filter -> servlet 同时还存在着这样一种配置节:context-param,它用于向 Servlet

使用spring的自身的listener进行web的配置

web.xml配置如下 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"          xsi:schemaLocation="http:/

web.xml 配置applicationContext.xml

web.xml中classpath:和classpath*:  有什么区别? classpath:只会到你的class路径中查找找文件; classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找. 有时候会用模糊匹配的方式配置多配置文件. 但是如果配置文件是在jar包里,模糊匹配就找不到了.可以用逗号隔开的方式配置多个配置文件. 如: <listener>  <listener-class>org.springframework.web.conte

SpringMVC4 + Spring + MyBatis3 基于注解的最简配置

本文使用最新版本(4.1.5)的springmvc+spring+mybatis,采用最间的配置方式来进行搭建. 1. web.xml 我们知道springmvc是基于DispatcherServlet来分发请求的,所以先在web.xml文件中搭建DispatcherServlet,还有spring的监听器: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5"

Spring 4.x实现Restful web service

首先我们还是跟之前一样,创建一个maven项目,不过因为Spring Restful web service是基于Spring 4.x版本的,所以我在这里就直接将Spring升级到了4.0.8,下面我贴出我的pom文件主要的依赖: <properties> <spring.version>4.0.8.RELEASE</spring.version> </properties> <dependencies> <dependency> &