今天在做SSH的一个项目的时候,因为需要定时操作,所以就再sping里面加入了一个quartz的小定时框架,结果在运行时候,发生了一个小bug. Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'org.quartz.spi.JobFactory' fo…
package com.xiaohao.action; import java.io.File; import java.lang.reflect.Method; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; /** *…
一.首先写一下代码结构. 二.再看web.xml中的配置情况. <?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:…
在前面的一篇日志中,记录了web.xml配置启动的顺序,web启动到监听器ContextLoaderListener时,开始加载spring的配置文件applicationContext.xml(通常就叫这个名字),在查询大量资料之后决心将该文件详细的配置说明和讲解记录下来,以供查阅,加深原理的理解.        首先是spring的各类命名空间和xml声明: <?xml version="1.0" encoding="UTF-8"?> <bea…
以下是详解Spring的applicationContext.xml文件代码:<!-- 头文件,主要注意一下编码 --><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"…
问题描述: 在配置spring的applicationContext.xml中的默认事务管理器的时候可能会出现这样的错误: Error occured processing XML 'org/springframework/transaction/interceptor/TransactionInterceptor'. See Error Log for more details 以下是xml配置: <bean id="transactionManager" class=&quo…
2011-11-08 16:29 web.xml中配置Spring中applicationContext.xml的方式 使用web.xml方式加载Spring时,获取Spring applicationContext.xml的方式 1.servlet方式加载: [web.xml] <servlet>    <servlet-name>dispatcherServlet</servlet-name>    <servlet-class>org.springfr…
首先需要JAR包 Spring整合Structs2的JAR包 struts2-spring-plugin-2.3.4.1.jar 下载地址 链接: https://pan.baidu.com/s/1o7I0Bdo 密码: eg3a spring-web-4.2.4.RELEASE.jar 这个JAR包在Spring框架包的libs中有 Structs2所需JAR包如下: 也需要放进来 我整理的Struts2下载地址 链接: https://pan.baidu.com/s/1mh9blwc 密码:…
配置实例 – 1 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.or…
1.在XML配置文件中配置切面.切入点.增强处理.spring-1.5之前只能使用XML Schema方式配置切面.切入点.增强处理. spring配置文件中,所有的切面.切入点.增强处理都必须定义在<aop:config.../>元素内部.<beans.../>元素可以包含多个<aop:config.../>元素,一个<aop:config>可以包含pointcut.advisor.aspect元素,且三个元素必须按照此顺序来定义.其中aspect下可以包…
概要: Spring配置文件是集成了Spring框架的项目的核心,引擎的开始是:容器先是加载web.xml,接着是applicationContext.xml在web.xml里的注册.以下我们将介绍applicationContext.xml在web.xml里的注册的两种方式. 目录 添加ContextLoaderListener这个监听器 添加ContextLoaderServlet这个servlet 添加ContextLoaderListener这个监听器 <context-param>…
eb.xml中classpath:和classpath*:  有什么区别? classpath:只会到你的class路径中查找找文件; classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找. 存放位置: 1:src下面 需要在web.xml中定义如下: <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath…
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">  <property name="dataSource" ref="dataSource"></property>  <property name="hibernateProperties&…
原来运行正常的项目,突然在applicationContext.xml 文件头报错 总结一下网上的解决方案: 1.有可能网络状况不好导致 如果使用Maven构建项目,spring在加载xsd文件时总是先试图在本地查找xsd文件(spring的jar包中已经包含了所有版本的xsd文件),如果没有找到,才会转向去URL指定的路径下载.所以出现该情况一般是因为断网或spring的官网暂时无法连接. 可以通过在浏览器地址栏输入xsd文件的URL,如:spring-beans的话,输入http://www…
原创链接:http://www.cnblogs.com/yanqin/p/5282929.html(允许转载,但请注明原创链接) BeanFactory加载单个文件 当使用beanfactory去获取bean,当你只是实例化该容器,那么容器内的bean不会被实例化,只有当使用某个bean(getBean)时,才会实时去实例化该bean. FileSystemResource和ClassPathResource都是实现了Resource接口,他们都可以用来加载XML文件. BeanFactory是…
一个web工程自动加载的配置文件只有web.xml,想要加载其他.xml必须在web.xml里面进行配置. 用spring的时候需要一个bean容器来管理所有的bean,所有bean默认是写在applicationContext.xml里的,在web.xml里面是这么设置的, <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/dispat…
梳理Spring的流程 xml是最常见的spring 应用系统配置源.Spring中的几种容器都支持使用xml装配bean,包括: XmlBeanFactory,ClassPathXmlApplicationContext,FileSystemXmlApplicationContext,XmlWebApplicationContext 一: XmlBeanFactory 引用资源 Resource resource = new ClassPathResource("appcontext.xml&…
Spring中注解注入 context:component-scan 的使用说明 通常情况下我们在创建spring项目的时候在xml配置文件中都会配置这个标签,配置完这个标签后,spring就会去自动扫描base-package对应的路径或者该路径的子包下面的java文件,如果扫描到文件中带有@Service,@Component,@Repository,@Controller等这些注解的类,则把这些类注册为bean 注:在注解后加上例如@Component(value=”abc”)时,注册的这…
我们通过一个小案例来看xml解析过程. 1. 导包 <dependencies> <!-- xml解析工具 --> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> </dependency> <!-- 常用工具包 --> <depe…
大家都知道Java读普通文件是通过Basic I/O 中的InputStream.OutStream.Reader.Writer 等实现的.在spring 框架中,它是怎样识别xml这个配置文件的呢? 这就要靠IoC容器的两个接口BeanFactory 和ApplicationContext: BeanFactory (接口) |--------XmlBeanFactory(实现类) ApplicationContext (接口) |-------- ClassPathXmlApplicatio…
描述 大家都知道Java读普通文件是通过Basic I/O 中的InputStream.OutStream.Reader.Writer 等实现的.在spring 框架中,它是怎样识别xml这个配置文件的呢? 这就要靠IoC容器的两个接口BeanFactory 和ApplicationContext:BeanFactory在spring-bean的jar里,ApplicationContext在spring-context的jar里. BeanFactory (接口) |--------XmlBe…
  <?xml version="1.0" encoding="UTF-8"?>   <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XML…
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/sch…
一.jdbc.properties 文件: driver=com.mysql.jdbc.Driverurl=jdbc:mysql://192.168.31.xxx:3306/abc?useUnicode=true&characterEncoding=utf-8&useSSL=falseusername=xxxpassword=xxx#定义初始连接数initialSize=0#定义最大连接数maxActive=20#定义最大空闲maxIdle=20#定义最小空闲minIdle=1#定义最长等…
昨天在jenkins构建代码后,执行mvn test 就报错如下: 提示的bean.xm不存在呀, 再来看源码ApplicationContext 的声明 ApplicationContext ctx=new ClassPathXmlApplicationContext("bean.xml"); 这样的写法一定是bean.xml在src/main/java下 那应该就是这里出的问题 由于Spring刚学也不是很熟,找了很久终于找到了一个解决方案 解决方案如下: 将bean.xml放在s…
转自:http://www.cnblogs.com/ztf2008/archive/2009/02/11/1388003.html <beans><bean id="person" class="org.spring.bean.Person"> <property name="name">      <value>zhangsan</value> /property> <pr…
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSche…
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"    xmlns:context="http://www.springframework.org/schema/context"    xmlns:xsi="http://www.w3.org/2001/XM…
http://www.springframework.org/schema/beans/spring-beans.xsd Window>>preference>>搜索xml(XML Catalog)…
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p&…