随笔分类 - spring学习笔记
摘要:struts-config.xml的配置文件必须按下面的顺序进行配置:1、display-name2、description3、data-sources4、form-beans5、global-exceptions6、global-forwards7、action-mappings8、controller9、message-resources*10、plug-in*如果不按此顺序会报如下异常:切记!严重: Parse Error at line 40 column 17: The content of element type "struts-config" must ma
阅读全文
摘要:Spring的框架中为您提供了一个 BeanFactoryPostProcessor 的实作类别: org.springframework.beans.factory.config.PropertyPlaceholderConfigurer。藉由这个类别,您可以将一些组态设定,移出至.properties档案中,如此的安排可以让XML定义档负责系统相关设定,而.properties档可以作为客户根据需求,自定义一些相关的参数。来看一个Bean定义档的实际例子: beans-config.xml<?xml version="1.0" encoding="UTF
阅读全文
摘要:Spring中ApplicationContext加载机制。 加载器目前有两种选择:ContextLoaderListener和ContextLoaderServlet。 这两者在功能上完全等同,只是一个是基于Servlet2.3版本中新引入的Listener接口实现,而另一个基于Servlet接口实现。开发中可根据目标Web容器的实际情况进行选择。 配置非常简单,在web.xml中增加: <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </list
阅读全文
摘要:web.xml 通过contextConfigLocation配置spring 的方式SSI框架配置文件路径问题:struts2的 1个+N个 路径:src+src(可配置) 名称: struts.xml + Nspring 的 1个 路径: src 名称: applicationContext.xmlibatis 的 1个+N个 路径: src+src(可配置) 名称: SqlMapConfig.xml + N部署到tomcat后,src目录下的配置文件会和class文件一样,自动copy到应用的 classes目录下spring的 配置文件在启动时,加载的是web-info目录下的appl
阅读全文

浙公网安备 33010602011771号