web.xml是web项目启动时首先被容器读取的配置文件,根据其中的配置创建实例并完成参数初始化等以保证项目能够正确启动运行.web.xml中配置的项目主要有这么几种,我对各个元素的作用了解如下:
上下文参数:
contextConfigLocation
classpath*:/config/applicationContext-*.xml
...
分类:
Web程序 时间:
2015-04-27 18:25:12
阅读次数:
120
Spring之所以抽象Resource接口,是因为传统的java使用URL和标准的handler来处置资源。但是有个局限是不能直接读取classpath下的资源。因此Spring定义了一套接口。这套接口分为两部分,Resource和ResourceLoader,其中是对资源的抽象,后者负责加载资源。Spring的ApplicationContext实现了ResourceLoader接口。
Res...
分类:
编程语言 时间:
2015-04-26 00:04:18
阅读次数:
146
ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息。因为它实现了ServletContextListener这个接口,在web.xml配置这个监听器,启动容器时,就会默认执行它实现的方法。至于ApplicationContex...
分类:
编程语言 时间:
2015-04-25 15:06:31
阅读次数:
120
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh‘ before accessing beans via the ApplicationContext at org.springframework.context.support.AbstractRefr...
分类:
编程语言 时间:
2015-04-24 17:00:38
阅读次数:
121
使用注解来构造IoC容器用注解来向Spring容器注册Bean。需要在applicationContext.xml中注册。如:在base-package指明一个包1 表明cn.gacl.java包及其子包中,如果某个类的头上带有特定的注解 【@Component/@Repository/@Servi...
分类:
编程语言 时间:
2015-04-23 21:27:32
阅读次数:
202
SpringMVC(注解)上传文件需要注意的几个地方:1、form的enctype="multipart/form-data",这个是上传文件必须的2、applicationContext.xml配置: ...
分类:
编程语言 时间:
2015-04-22 23:54:12
阅读次数:
169
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.lmc.ink.entity.seo.Email;
import com.lmc.ink.service.seo.Em...
分类:
编程语言 时间:
2015-04-22 18:27:47
阅读次数:
167
今天在配applicationContext.xml的时候出现了这样一个错误:
x: White spaces are required between publicId and systemId
我用的是Spring3.0.5
错误在于下列标签的顺序必须按照下面的来
xsi:schemaLocation="http://www.springframework.org/schema/bea...
分类:
其他好文 时间:
2015-04-22 18:17:17
阅读次数:
129
Spring的主要功能是控制反转和面向切面编程,下面我们就来编写第一个spring的程序来体验一下控制反转首先是加载配置文件下面我们在程序中加载配置文件ApplicationContext ac = new ClassPathXmlApplicationContext("spring.xml");然...
分类:
编程语言 时间:
2015-04-22 10:58:31
阅读次数:
121
首先是bean.xml,配置所有的bean,一般也叫applicationContext.xml,应用程序上下文。示例: ...
分类:
编程语言 时间:
2015-04-18 23:22:01
阅读次数:
126