`

Spring的schemaResolver

    博客分类:
  • XML
 
阅读更多
Spring解析xml可以参考以上,可以指定自定义的schema,使用Jdk提供的xml API解析xml.
接下来Spring针对自己的schema,针对自己定义的xml元素,解析并注入到Spring的Bean中。

为了保持Spring的高可扩展性,用户可以在Spring的基础上最大限度的开放,这里采用了Schema Resolver,解析器采用最基本的Document Element.

这里给个例子并不是基本Spring的插件体系,不过原因相同。

package org.frame.base.xml.jdk.bk;

import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.frame.base.xml.jdk.Contact;
import org.frame.base.xml.jdk.ContactName;
import org.frame.base.xml.jdk.MaySimpleSaxErrorHandler;
import org.frame.base.xml.jdk.MyPluggableSchemaResolver;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

/**
 * Spring提供自定义schema,并提供自定义schema解析类, 并集成到Spring框架中
 * 
 * @author ycl
 * @version 1.0 2012-12-17 下午4:59:08
 * @since 1.0
 * 
 */
public class TestSpringNamespaceHandler {
	protected final static Log logger = LogFactory.getLog(TestSpringNamespaceHandler.class);
	
	public static MyNamespaceHandlerResolver namespaceHandlerResolver = new DefaultMyNamespaceHandlerResolver();

	public static void main(String[] args) {
		// set jaxp debug
		System.setProperty("jaxp.debug", "1");
		DocumentBuilderFactory builderFactory = DocumentBuilderFactory
				.newInstance();

		// 设置使用命名空间
		builderFactory.setNamespaceAware(true);
		builderFactory.setValidating(true);
		builderFactory.setIgnoringComments(true);
		builderFactory.setAttribute(
				"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
				"http://www.w3.org/2001/XMLSchema");
		// 如果使用xsd,一船需要设置schemaLanguage的schema版本.

		ErrorHandler errorHandler = new MaySimpleSaxErrorHandler(logger);
		// 异常处理类
		EntityResolver entityResolver = new MyPluggableSchemaResolver(
				TestDocumentBuilderFactory.class.getClassLoader());
		// 实体分解类

		Document document = parse(builderFactory, getInputSource(),
				entityResolver, errorHandler);

		print(document);
		printByHander(document);
	}
	
	private static void printByHander(Document document){
		Map<String,Object> context = new HashMap<String,Object>();
		Element root = document.getDocumentElement();
		
		String namespaceUri = getNamespaceURI(root);
		MyNamespaceHandler handler = namespaceHandlerResolver.resolve(namespaceUri); 
		handler.parse((Element) root,context); 
		//根元素解析
		parserElement(root,context); 
		Contact contact = (Contact)context.get("contact");
		System.out.println(contact);
	}

	private static void parserElement(Element root,Map<String,Object> context) { 
		NodeList nodes = root.getChildNodes();
		if(nodes!=null&&nodes.getLength()>0){
			for (int i = 0; i < nodes.getLength(); i++) {
				Node node = nodes.item(i);  
				String namespaceUri = getNamespaceURI(node);
				if(namespaceUri!=null){
					MyNamespaceHandler handler = namespaceHandlerResolver.resolve(namespaceUri); 
					handler.parse((Element) node,context);
					parserElement((Element)node,context);
				}
			}
		}
	}

	private static void print(Document document) {
		Element root = document.getDocumentElement();
		 
		List<ContactName> contactNameList = new ArrayList<ContactName>();

		ContactName contactItem;

		// 子元素列表
		NodeList nodes = root.getChildNodes();
		 
		/**
		 * code this is so tied.
		 */
		for (int i = 0; i < nodes.getLength(); i++) {
			Node node = nodes.item(i); 
			if (node instanceof Element) {
				// a child element to process
				Element child = (Element) node;
				String width = child.getAttribute("width");
				contactItem = new ContactName();
				contactItem.setWidth(width);
				NodeList itemSub = node.getChildNodes();
				for (int j = 0; j < itemSub.getLength(); j++) {
					Node itemSubNode = itemSub.item(j);
					if (itemSubNode instanceof Element) {
						if (((Element) itemSubNode).getTagName().equals("uic")) {
							contactItem.setUid(itemSubNode.getTextContent());
						} else if (((Element) itemSubNode).getTagName().equals(
								"fullName")) {
							contactItem.setFullName(itemSubNode
									.getTextContent());
						}
					}
				}
				contactNameList.add(contactItem);
			}
		}
		System.out.println(contactNameList);
	}
	
	/**
	 * 获取节点的namespace
	 * @param node
	 * @return
	 */
	public static String getNamespaceURI(Node node) {
		return node.getNamespaceURI();
	}

	
	private static InputSource getInputSource() {
		StringBuffer xml = new StringBuffer(
				"<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		xml.append("<contact xmlns=\"http://www.ycl.com/schema/schema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.ycl.com/schema/schema  http://www.ycl.com/schema/schema.xsd\" >");
		xml.append("<!--ycl is good -->");
		xml.append("<item width=\"10\">");
		xml.append("<uic>1</uic>");
		xml.append("<fullName>ycl1</fullName>");
		xml.append("</item>");

		xml.append("<item width=\"11\">");
		xml.append("<uic>1 <![CDATA[06:00 Vesti<br>06:05 Jutarnji]]> 2</uic>");
		xml.append("<fullName>ycl2</fullName>");
		xml.append("</item>");

		xml.append("</contact>");

		InputSource is = new InputSource(new StringReader(xml.toString()));
		return is;
	}

	private static Document parse(DocumentBuilderFactory builderFactory,
			InputSource is, EntityResolver entityResolver,
			ErrorHandler errorHandler) {
		DocumentBuilder builder = null;

		Document document = null;
		try {
			builder = builderFactory.newDocumentBuilder();
			if (entityResolver != null) {
				builder.setEntityResolver(entityResolver);
			}
			if (errorHandler != null) {
				builder.setErrorHandler(errorHandler);
			}
			document = builder.parse(is);
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return document;
	}
}


测试类,主要是使用schema,并定义schema Resolver.
package org.frame.base.xml.jdk.bk;


public interface MyNamespaceHandlerResolver {

	/**
	 * 对应schema 对应的 name handler
	 * @param namespaceUri
	 * @return
	 */
	MyNamespaceHandler resolve(String namespaceUri);
}



/*
 * Copyright 2002-2009 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.frame.base.xml.jdk.bk;

import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
import org.springframework.beans.factory.xml.NamespaceHandler;
import org.springframework.beans.factory.xml.NamespaceHandlerResolver;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.CollectionUtils;

/**
 * Default implementation of the {@link NamespaceHandlerResolver} interface.
 * Resolves namespace URIs to implementation classes based on the mappings
 * contained in mapping file.
 *
 * <p>By default, this implementation looks for the mapping file at
 * <code>META-INF/spring.handlers</code>, but this can be changed using the
 * {@link #DefaultNamespaceHandlerResolver(ClassLoader, String)} constructor.
 *
 * @author Rob Harrop
 * @author Juergen Hoeller
 * @since 2.0
 * @see NamespaceHandler
 * @see DefaultBeanDefinitionDocumentReader
 */
public class DefaultMyNamespaceHandlerResolver implements MyNamespaceHandlerResolver {

	/**
	 * The location to look for the mapping files. Can be present in multiple JAR files.
	 */
	public static final String DEFAULT_HANDLER_MAPPINGS_LOCATION = "META-INF/myschema.handlers";


	/** Logger available to subclasses */
	protected final Log logger = LogFactory.getLog(getClass());

	/** ClassLoader to use for NamespaceHandler classes */
	private final ClassLoader classLoader;

	/** Resource location to search for */
	private final String handlerMappingsLocation;

	/** Stores the mappings from namespace URI to NamespaceHandler class name / instance */
	private volatile Map<String, Object> handlerMappings;


	/**
	 * Create a new <code>DefaultNamespaceHandlerResolver</code> using the
	 * default mapping file location.
	 * <p>This constructor will result in the thread context ClassLoader being used
	 * to load resources.
	 * @see #DEFAULT_HANDLER_MAPPINGS_LOCATION
	 */
	public DefaultMyNamespaceHandlerResolver() {
		this(null, DEFAULT_HANDLER_MAPPINGS_LOCATION);
	}

	/**
	 * Create a new <code>DefaultNamespaceHandlerResolver</code> using the
	 * default mapping file location.
	 * @param classLoader the {@link ClassLoader} instance used to load mapping resources
	 * (may be <code>null</code>, in which case the thread context ClassLoader will be used)
	 * @see #DEFAULT_HANDLER_MAPPINGS_LOCATION
	 */
	public DefaultMyNamespaceHandlerResolver(ClassLoader classLoader) {
		this(classLoader, DEFAULT_HANDLER_MAPPINGS_LOCATION);
	}

	/**
	 * Create a new <code>DefaultNamespaceHandlerResolver</code> using the
	 * supplied mapping file location.
	 * @param classLoader the {@link ClassLoader} instance used to load mapping resources
	 * may be <code>null</code>, in which case the thread context ClassLoader will be used)
	 * @param handlerMappingsLocation the mapping file location
	 */
	public DefaultMyNamespaceHandlerResolver(ClassLoader classLoader, String handlerMappingsLocation) {
		Assert.notNull(handlerMappingsLocation, "Handler mappings location must not be null");
		this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
		this.handlerMappingsLocation = handlerMappingsLocation;
	}


	/**
	 * Locate the {@link NamespaceHandler} for the supplied namespace URI
	 * from the configured mappings.
	 * @param namespaceUri the relevant namespace URI
	 * @return the located {@link NamespaceHandler}, or <code>null</code> if none found
	 */
	public MyNamespaceHandler resolve(String namespaceUri) {
		Map<String, Object> handlerMappings = getHandlerMappings();
		Object handlerOrClassName = handlerMappings.get(namespaceUri);
		if (handlerOrClassName == null) {
			return null;
		}
		else if (handlerOrClassName instanceof MyNamespaceHandler) {
			return (MyNamespaceHandler) handlerOrClassName;
		}
		else {
			String className = (String) handlerOrClassName;
			try {
				Class<?> handlerClass = ClassUtils.forName(className, this.classLoader);
				if (!MyNamespaceHandler.class.isAssignableFrom(handlerClass)) {
					throw new FatalBeanException("Class [" + className + "] for namespace [" + namespaceUri +
							"] does not implement the [" + MyNamespaceHandler.class.getName() + "] interface");
				}
				MyNamespaceHandler namespaceHandler = (MyNamespaceHandler) BeanUtils.instantiateClass(handlerClass);
				namespaceHandler.init();
				handlerMappings.put(namespaceUri, namespaceHandler);
				return namespaceHandler;
			}
			catch (ClassNotFoundException ex) {
				throw new FatalBeanException("NamespaceHandler class [" + className + "] for namespace [" +
						namespaceUri + "] not found", ex);
			}
			catch (LinkageError err) {
				throw new FatalBeanException("Invalid NamespaceHandler class [" + className + "] for namespace [" +
						namespaceUri + "]: problem with handler class file or dependent class", err);
			}
		}
	}

	/**
	 * Load the specified NamespaceHandler mappings lazily.
	 */
	private Map<String, Object> getHandlerMappings() {
		if (this.handlerMappings == null) {
			synchronized (this) {
				if (this.handlerMappings == null) {
					try {
						Properties mappings =
								PropertiesLoaderUtils.loadAllProperties(this.handlerMappingsLocation, this.classLoader);
						if (logger.isDebugEnabled()) {
							logger.debug("Loaded NamespaceHandler mappings: " + mappings);
						}
						Map<String, Object> handlerMappings = new ConcurrentHashMap<String, Object>();
						CollectionUtils.mergePropertiesIntoMap(mappings, handlerMappings);
						this.handlerMappings = handlerMappings;
					}
					catch (IOException ex) {
						throw new IllegalStateException(
								"Unable to load NamespaceHandler mappings from location [" + this.handlerMappingsLocation + "]", ex);
					}
				}
			}
		}
		return this.handlerMappings;
	}


	@Override
	public String toString() {
		return "NamespaceHandlerResolver using mappings " + getHandlerMappings();
	}

}


请允许我的偷懒,赤裸裸的copy Spring 源码.
public interface MyNamespaceHandler {

	public void init();
	public ContactName parse(Element element,Map<String,Object> context);
}


package org.frame.base.xml.jdk.bk;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.frame.base.xml.jdk.ContactName;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.FatalBeanException;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.CollectionUtils;
import org.w3c.dom.Element;

public class SchemaNamespaceHandler implements MyNamespaceHandler {
	
	/**
	 * The location to look for the mapping files. Can be present in multiple JAR files.
	 */
	public static final String DEFAULT_HANDLER_MAPPINGS_LOCATION = "META-INF/schema/contact.handler";
	
	/** Logger available to subclasses */
	protected final Log logger = LogFactory.getLog(getClass());

	/** ClassLoader to use for NamespaceHandler classes */
	private final ClassLoader classLoader;

	/** Resource location to search for */
	private final String handlerMappingsLocation;

	/** Stores the mappings from namespace URI to NamespaceHandler class name / instance */
	private volatile Map<String, Object> handlerMappings; 
	
	public SchemaNamespaceHandler(){
		this(null, DEFAULT_HANDLER_MAPPINGS_LOCATION);
	}
	
	public SchemaNamespaceHandler(ClassLoader classLoader) {
		this(classLoader, DEFAULT_HANDLER_MAPPINGS_LOCATION);
	}
	
	public SchemaNamespaceHandler(ClassLoader classLoader, String handlerMappingsLocation) {
		Assert.notNull(handlerMappingsLocation, "Handler mappings location must not be null");
		this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
		this.handlerMappingsLocation = handlerMappingsLocation;
	}


	@Override
	public void init() {
		// TODO Auto-generated method stub 
	}

	@Override
	public ContactName parse(Element element,Map<String,Object> context) { 
		return resolve(element.getLocalName()).parse(element,context);
	}
	
	public MyNamespaceHandler resolve(String namespaceUri) {
		Map<String, Object> handlerMappings = getHandlerMappings();
		Object handlerOrClassName = handlerMappings.get(namespaceUri);
		if (handlerOrClassName == null) {
			return null;
		}
		else if (handlerOrClassName instanceof MyNamespaceHandler) {
			return (MyNamespaceHandler) handlerOrClassName;
		}
		else {
			String className = (String) handlerOrClassName;
			try {
				Class<?> handlerClass = ClassUtils.forName(className, this.classLoader);
				if (!MyNamespaceHandler.class.isAssignableFrom(handlerClass)) {
					throw new FatalBeanException("Class [" + className + "] for namespace [" + namespaceUri +
							"] does not implement the [" + MyNamespaceHandler.class.getName() + "] interface");
				}
				MyNamespaceHandler namespaceHandler = (MyNamespaceHandler) BeanUtils.instantiateClass(handlerClass);
				namespaceHandler.init();
				handlerMappings.put(namespaceUri, namespaceHandler);
				return namespaceHandler;
			}
			catch (ClassNotFoundException ex) {
				throw new FatalBeanException("NamespaceHandler class [" + className + "] for namespace [" +
						namespaceUri + "] not found", ex);
			}
			catch (LinkageError err) {
				throw new FatalBeanException("Invalid NamespaceHandler class [" + className + "] for namespace [" +
						namespaceUri + "]: problem with handler class file or dependent class", err);
			}
		}
	}
	
	/**
	 * Load the specified NamespaceHandler mappings lazily.
	 */
	private Map<String, Object> getHandlerMappings() {
		if (this.handlerMappings == null) {
			synchronized (this) {
				if (this.handlerMappings == null) {
					try {
						Properties mappings =
								PropertiesLoaderUtils.loadAllProperties(this.handlerMappingsLocation, this.classLoader);
						if (logger.isDebugEnabled()) {
							logger.debug("Loaded NamespaceHandler mappings: " + mappings);
						}
						Map<String, Object> handlerMappings = new ConcurrentHashMap<String, Object>();
						CollectionUtils.mergePropertiesIntoMap(mappings, handlerMappings);
						this.handlerMappings = handlerMappings;
					}
					catch (IOException ex) {
						throw new IllegalStateException(
								"Unable to load NamespaceHandler mappings from location [" + this.handlerMappingsLocation + "]", ex);
					}
				}
			}
		}
		return this.handlerMappings;
	}


	@Override
	public String toString() {
		return "NamespaceHandlerResolver using mappings " + getHandlerMappings();
	}


}



接下来看下我们的配置文件如下:
myschema.handlers
http\://www.ycl.com/schema/schema=org.frame.base.xml.jdk.bk.SchemaNamespaceHandler

contact.handler
contact=org.frame.base.xml.jdk.bk.ContactHandler
item=org.frame.base.xml.jdk.bk.ItemHandler
uic=org.frame.base.xml.jdk.bk.UicHandler
fullName=org.frame.base.xml.jdk.bk.FullNameHandler

我这里对xml中的每一个元素都定义了Handler
package org.frame.base.xml.jdk.bk;

import java.util.Map;

import org.frame.base.xml.jdk.Contact;
import org.frame.base.xml.jdk.ContactName;
import org.w3c.dom.Element;

/**
 * 这里可以包含其他元素进行解析
 *
 * @author ycl
 * @version 1.0 2012-12-18 上午9:32:12
 * @since 1.0
 *
 */
public class ContactHandler implements MyNamespaceHandler {

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public ContactName parse(Element element,Map<String,Object> context) {
		Contact contactName = new Contact(); 
		context.put("contact", contactName);
		return null;
	}

}


package org.frame.base.xml.jdk.bk;

import java.util.Map;

import org.frame.base.xml.jdk.Contact;
import org.frame.base.xml.jdk.ContactName;
import org.frame.base.xml.jdk.Item;
import org.w3c.dom.Element;

public class ItemHandler implements MyNamespaceHandler {

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public ContactName parse(Element element, Map<String, Object> context) {
		Contact contactName = (Contact) context.get("contact");
		String width = element.getAttribute("width");
		Item item = new Item();
		item.setWidth(width);
		contactName.addItem(item);
		context.put("curentItem", item);
		return null;
	}

}


package org.frame.base.xml.jdk.bk;

import java.util.Map;

import org.frame.base.xml.jdk.Contact;
import org.frame.base.xml.jdk.ContactName;
import org.frame.base.xml.jdk.Item;
import org.w3c.dom.Element;

public class UicHandler implements MyNamespaceHandler {

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public ContactName parse(Element element, Map<String, Object> context) {
		Item item = (Item)context.get("curentItem");
		String uic = element.getTextContent();
		item.setUic(uic);
		return null;
	}

}



package org.frame.base.xml.jdk.bk;

import java.util.Map;

import org.frame.base.xml.jdk.ContactName;
import org.frame.base.xml.jdk.Item;
import org.w3c.dom.Element;

public class FullNameHandler implements MyNamespaceHandler {

	@Override
	public void init() {
		// TODO Auto-generated method stub

	}

	@Override
	public ContactName parse(Element element, Map<String, Object> context) {
		Item item = (Item)context.get("curentItem");
		String fullName = element.getTextContent();
		item.setFullName(fullName);
		return null;
	}

}



当然也,这里图个简单,解析整个xml,而在resolver中可以解析自己需要的xml元素到自己的Context中,context可以放任何中东西,这是一个上下文。

输出数据如下:
20121218-10:56:08 main org.springframework.beans.factory.xml.PluggableSchemaResolver Loading schema mappings from [META-INF/myschema.schemas]
20121218-10:56:08 main org.springframework.beans.factory.xml.PluggableSchemaResolver Loaded schema mappings: {http://www.ycl.com/schema/schema.xsd=org/frame/base/xml/jdk/schema.xsd}
20121218-10:56:08 main org.springframework.beans.factory.xml.PluggableSchemaResolver Found XML schema [http://www.ycl.com/schema/schema.xsd] in classpath: org/frame/base/xml/jdk/schema.xsd
[uid:1,fullName:ycl1,width:10, uid:1 06:00 Vesti<br>06:05 Jutarnji 2,fullName:ycl2,width:11]
20121218-10:56:08 main org.frame.base.xml.jdk.bk.DefaultMyNamespaceHandlerResolver Loaded NamespaceHandler mappings: {http://www.ycl.com/schema/schema=org.frame.base.xml.jdk.bk.SchemaNamespaceHandler}
20121218-10:56:08 main org.frame.base.xml.jdk.bk.SchemaNamespaceHandler Loaded NamespaceHandler mappings: {contact=org.frame.base.xml.jdk.bk.ContactHandler, uic=org.frame.base.xml.jdk.bk.UicHandler, item=org.frame.base.xml.jdk.bk.ItemHandler, fullName=org.frame.base.xml.jdk.bk.FullNameHandler}
[width:10,uic:1,fullName:ycl1,sex:null, width:11,uic:1 06:00 Vesti<br>06:05 Jutarnji 2,fullName:ycl2,sex:null]



这里可以输出自定义的handler,和自己想要的结果。
使用resolver 这种解析模式,你不需要关系xml结构,不需要关系xml到Java对象的关系。
你关心的只是xml元素,我需要解析xml中的元素到我的对象中,而xml元素和Java对象不存在必然的联系,这也是传说中的”解耦“吗.

我这里只是把每个元素都设计了Handler,如果使用这种解析模式,使用属性会让代码引人缩短,而且更易理解(怪不得bean这么多属性).

Spring对于Bean的设计也允许有子元素,那就是Properties,其实也是属性,只是放在子元素上看起来也更美观,逻辑更清晰,也更突显了Bean注入的强烈优势.
分享到:
评论

相关推荐

    Spring Boot整合Spring Batch,实现批处理

    在Java开发领域,Spring Boot和Spring Batch的整合是构建高效批处理系统的一种常见方式。Spring Boot以其简洁的配置和快速的启动能力深受开发者喜爱,而Spring Batch作为Spring框架的一部分,专注于批量处理任务,...

    spring2.0升级到spring3.0.5的开发包

    Spring框架是Java应用程序开发中的一个核心组件,它提供了一个丰富的IOC(Inversion of Control,控制反转)和AOP(Aspect-Oriented Programming,面向切面编程)功能,使得开发者能够更方便地管理对象和实现模块化...

    java *spring工具类 方便在非spring管理环境中获取bean

    java *spring工具类 方便在非spring管理环境中获取beanjava *spring工具类 方便在非spring管理环境中获取beanjava *spring工具类 方便在非spring管理环境中获取beanjava *spring工具类 方便在非spring管理环境中获取...

    Spring Integration + Spring WS 整合

    Spring Integration + Spring WS 整合 在 Java 领域中,Spring Integration 和 Spring WS 是两个常用的框架,它们分别负责集成系统和 Web 服务。今天,我们将探讨如何将这两个框架整合在一起,实现一个完整的 Web ...

    Spring Cloud Gateway 整合 Spring Security 统一登录认证鉴权

    在构建分布式系统时,Spring Cloud Gateway 作为微服务架构中的边缘服务或 API 网关,扮演着至关重要的角色。它负责路由请求到相应的微服务,并可以提供过滤器功能,如限流、熔断等。而Spring Security 则是 Java ...

    SpringBatch+Spring+Mybatis+MySql (spring batch 使用jar)

    Spring Batch是一个轻量级的,完全面向Spring的批处理框架,可以应用于企业级大量的数据处理系统。Spring Batch以POJO和大家熟知的Spring框架为基础,使开发者更容易的访问和利用企业级服务。Spring Batch可以提供...

    Getting started with Spring Framework: covers Spring 5(epub)

    Getting started with Spring Framework (4th Edition) is a hands-on guide to begin developing applications using Spring Framework 5. The examples (consisting of 88 sample projects) that accompany this ...

    spring6pdf详细讲解

    Spring 详细讲解 Spring 是一个功能强大且功能齐全的 Java 应用程序框架,提供了一个通用的基础结构来支持开发企业级应用程序。 Spring 框架的核心是控制反转(IoC)和依赖注入(DI)模式,它们使得应用程序更加...

    spring揭秘.rar_Spring揭秘 下载_spring mvc_spring 揭秘_spring揭秘

    spring揭秘,了解spring内在运行逻辑

    spring3.0.5 所有jar文件

    包含spring 3.0.5的所有jar文件: org.springframework.aop-3.0.5.RELEASE.jar org.springframework.asm-3.0.5.RELEASE.jar org.springframework.aspects-3.0.5.RELEASE.jar org.springframework.beans-3.0.5.RELEASE...

    spring3.1 官方全部jar包

    spring3.1官方所有的jar包 org.springframework.aop-3.1.RELEASE.jar org.springframework.asm-3.1.RELEASE.jar org.springframework.aspects-3.1.RELEASE.jar org.springframework.beans-3.1.RELEASE.jar org....

    spring3.0.0相关jar包

    spring3.0.0相关jar包 org.springframework.aop-3.0.0.RELEASE org.springframework.asm-3.0.0.RELEASE org.springframework.aspects-3.0.0.RELEASE org.springframework.beans-3.0.0.RELEASE org.springframework....

    spring4.3.1官方全套jar包下载

    spring4.3.1全套jar下载。 4.3.1/spring-aop-4.3.1.RELEASE.jar 4.3.1/spring-aspects-4.3.1.RELEASE.jar 4.3.1/spring-beans-4.3.1.RELEASE.jar 4.3.1/spring-context-4.3.1.RELEASE.jar 4.3.1/spring-core-4.3.1....

    spring_in_action-sixth-edition.pdf

    "Spring 实战第六版" Spring Framework 是一个广泛使用的 Java 应用程序框架,它提供了一个通用的编程模型和配置机制,帮助开发者快速构建企业级应用程序。下面是对 Spring Framework 的详细知识点总结: 1. 什么...

    spring 5 , Spring Boot 2.0,Spring cloud

    标题中的“Spring 5, Spring Boot 2.0, Spring Cloud”揭示了三个核心的Java开发框架和技术。这些是Spring框架的最新版本,Spring Boot的第二个主要版本,以及用于构建微服务架构的Spring Cloud。 首先,Spring 5是...

    spring 4.3.14(全)最新的spring4正式版

    Spring 框架是 Java 开发中的一个核心组件,它为构建企业级应用程序提供了全面的编程和配置模型。Spring 4.3.14 是该框架的最后一个4.x系列正式版,发布于2018年2月24日。这个版本在Spring 5.0发布之前提供了一个...

    spring整合rabbitmq需要的jar包(spring版本4.2.0)

    在IT行业中,Spring框架是Java应用开发中的一个关键组件,它提供了一整套服务来简化企业级应用的构建。RabbitMQ则是一个流行的开源消息队列系统,它基于AMQP(Advanced Message Queuing Protocol)协议,用于高效地...

    Spring cloud与Spring boot 集成完整案例

    Spring Cloud和Spring Boot是两个非常重要的Java开发框架,它们在微服务架构中扮演着核心角色。Spring Boot简化了创建独立的、生产级别的基于Spring的应用程序的过程,而Spring Cloud则为开发者提供了快速构建分布式...

    SpringCloud项目实战各组件源代码案例

    Spring Cloud系列教程 Spring Boot Spring Cloud Stream 和 Kafka案例教程 springcloud生产者与消费者项目实战案例 Spring Cloud 中断路器 Circuit Breaker的应用 配置 Spring Cloud Config Server Spring Cloud ...

    spring-mock.jar

    Classes contained in spring-mock.jar: org.springframework.mock.jndi.ExpectedLookupTemplate.class org.springframework.mock.jndi.SimpleNamingContext.class org.springframework.mock.jndi....

Global site tag (gtag.js) - Google Analytics