随笔分类 -  spring

摘要:Spring 和 struts 整合的三种方式。1,使用Spring 的 ActionSupport 2, 使用Spring 的 DelegatingRequestProcessor 类。3,全权委托。无论用那种方法来整合第一步就是要为struts来装载spring的应用环境。 就是在 struts 中加入一个插件。struts-config.xml中<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"><set-property property="con 阅读全文
posted @ 2008-06-02 06:16 shine_panda
摘要:1,通过Listener加载ApplicationContext<context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/applicationContext.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</l 阅读全文
posted @ 2008-06-01 15:52 shine_panda
摘要:Spring通过PropertyEdit(属性编辑器) 可以将字符串转换为真实类型。通过CustomEditorConfigurer ,ApplicationContext 可以很方便的支持自定义PropertyEdit。MyType.javapackage com.cao.spring.applicationContext;public class MyType {private String text;public MyType(String text){this.text = text;}public String getText(){return this.text;}}Depends 阅读全文
posted @ 2008-05-30 20:44 shine_panda
摘要:在Spring 中最核心的组件是bean工厂,它提供了基本的反向控制和依赖注入的能力。Spring 是一种无侵入性的框架,被bean工厂管理的组件无须知道spring的存在。bean工厂负责打造bean,并注射它们之间的依赖。这些bean会彼此协作。 spring中最基本的BeanFactory接口org.springframework.beans.factory.BeanFactory ,它提供一些工厂的基本方法。packageorg.springframework.beans.factory;importorg.springframework.beans.BeansFaException; 阅读全文
posted @ 2008-05-28 06:03 shine_panda
摘要:学程序大多是从HelloWorld开始 . 自己也是通过参考书看了这个例子 加上自己的一点体会. 来理解Spring 的核心在Hello World的例子中我们有两个角色 1, 消息提供者 ,2,消息显示者. 通过分离她们的职责我们来理解Spring的 DItemp.propertiesdisplayer = ConcreteMessageDisplayersupplier = HelloWorldMessageSupplierMessageSupplier.javapublic interface MessageSupplier{//取得消息String getMessage();}Mess 阅读全文
posted @ 2008-05-15 07:49 shine_panda