From 91ac0bfefa04e17980680f3e13b426769642aa8e Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 19 Jul 2016 17:46:17 +0200 Subject: [PATCH] Reinstated support for spring-beans.dtd (streamlined like xsd) Issue: SPR-13499 --- .../beans/factory/xml/BeansDtdResolver.java | 10 +- .../beans/factory/xml/spring-beans.dtd | 662 ++++++++++++++++++ 2 files changed, 666 insertions(+), 6 deletions(-) create mode 100644 spring-beans/src/main/resources/org/springframework/beans/factory/xml/spring-beans.dtd diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java index ad096bff7b..dba29ca05f 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/BeansDtdResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 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. @@ -30,8 +30,8 @@ import org.springframework.core.io.Resource; * EntityResolver implementation for the Spring beans DTD, * to load the DTD from the Spring class path (or JAR file). * - *

Fetches "spring-beans-2.0.dtd" from the class path resource - * "/org/springframework/beans/factory/xml/spring-beans-2.0.dtd", + *

Fetches "spring-beans.dtd" from the class path resource + * "/org/springframework/beans/factory/xml/spring-beans.dtd", * no matter whether specified as some local URL that includes "spring-beans" * in the DTD name or as "http://www.springframework.org/dtd/spring-beans-2.0.dtd". * @@ -44,8 +44,6 @@ public class BeansDtdResolver implements EntityResolver { private static final String DTD_EXTENSION = ".dtd"; - private static final String DTD_FILENAME = "spring-beans-2.0"; - private static final String DTD_NAME = "spring-beans"; private static final Log logger = LogFactory.getLog(BeansDtdResolver.class); @@ -61,7 +59,7 @@ public class BeansDtdResolver implements EntityResolver { int lastPathSeparator = systemId.lastIndexOf("/"); int dtdNameStart = systemId.indexOf(DTD_NAME, lastPathSeparator); if (dtdNameStart != -1) { - String dtdFile = DTD_FILENAME + DTD_EXTENSION; + String dtdFile = DTD_NAME + DTD_EXTENSION; if (logger.isTraceEnabled()) { logger.trace("Trying to locate [" + dtdFile + "] in Spring jar on classpath"); } diff --git a/spring-beans/src/main/resources/org/springframework/beans/factory/xml/spring-beans.dtd b/spring-beans/src/main/resources/org/springframework/beans/factory/xml/spring-beans.dtd new file mode 100644 index 0000000000..f87b775a0e --- /dev/null +++ b/spring-beans/src/main/resources/org/springframework/beans/factory/xml/spring-beans.dtd @@ -0,0 +1,662 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +