language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.oxm/pom.xml | @@ -6,12 +6,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<packaging>jar</packaging>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
<parent>
<groupId>org.springframework</groupId>
<artifactId>spring-parent</artifactId>
<relativePath>../org.springframework.spring-parent</relativePath>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
</parent>
<dependencies> | true |
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.spring-library/pom.xml | @@ -1,164 +1,164 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
- <!--
-
- This POM cannot be used to build Spring; it is a work in progress and should only be used as
- part of a Maven repository upload bundle using artifacts created by the spring build system.
-
- -->
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-library</artifactId>
- <packaging>libd</packaging>
- <version>3.0.2.BUILD-SNAPSHOT</version>
- <name>Spring Framework</name>
- <description>Spring is a layered Java/J2EE application platform, based on code published in Expert
- One-on-One J2EE Design and Development by Rod Johnson (Wrox, 2002). </description>
- <url>http://www.springframework.org</url>
- <issueManagement>
- <system>JIRA</system>
- <url>http://jira.springframework.org/browse/SPR</url>
- </issueManagement>
- <ciManagement>
- <system>Bamboo</system>
- <url>https://build.springframework.org/browse/SPR</url>
- </ciManagement>
- <inceptionYear>2003</inceptionYear>
- <organization>
- <name>SpringSource</name>
- <url>http://www.springsource.com</url>
- </organization>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <url>https://fisheye.springframework.org/browse/spring-framework</url>
- <connection>scm:svn:https://src.springframework.org/svn/spring-framework/trunk</connection>
- <developerConnection>scm:svn:https://src.springframework.org/svn/spring-framework/trunk</developerConnection>
- </scm>
- <mailingLists>
- <mailingList>
- <name> Spring Forum
- </name>
- <post>http://forum.springframework.org</post>
- <archive>http://forum.springframework.org</archive>
- </mailingList>
- </mailingLists>
-
- <profiles>
- <profile>
- <id>staging</id>
- <distributionManagement>
- <site>
- <id>staging</id>
- <url>file:///${user.dir}/target/staging</url>
- </site>
- <repository>
- <id>staging</id>
- <url>file:///${user.dir}/target/staging</url>
- </repository>
- <snapshotRepository>
- <id>staging</id>
- <url>file:///${user.dir}/target/staging</url>
- </snapshotRepository>
- </distributionManagement>
- </profile>
- </profiles>
-
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-asm</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aspects</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jms</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-orm</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-oxm</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc-portlet</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>aopalliance</groupId>
- <artifactId>aopalliance</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <!--
+
+ This POM cannot be used to build Spring; it is a work in progress and should only be used as
+ part of a Maven repository upload bundle using artifacts created by the spring build system.
+
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-library</artifactId>
+ <packaging>libd</packaging>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
+ <name>Spring Framework</name>
+ <description>Spring is a layered Java/J2EE application platform, based on code published in Expert
+ One-on-One J2EE Design and Development by Rod Johnson (Wrox, 2002). </description>
+ <url>http://www.springframework.org</url>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://jira.springframework.org/browse/SPR</url>
+ </issueManagement>
+ <ciManagement>
+ <system>Bamboo</system>
+ <url>https://build.springframework.org/browse/SPR</url>
+ </ciManagement>
+ <inceptionYear>2003</inceptionYear>
+ <organization>
+ <name>SpringSource</name>
+ <url>http://www.springsource.com</url>
+ </organization>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <scm>
+ <url>https://fisheye.springframework.org/browse/spring-framework</url>
+ <connection>scm:svn:https://src.springframework.org/svn/spring-framework/trunk</connection>
+ <developerConnection>scm:svn:https://src.springframework.org/svn/spring-framework/trunk</developerConnection>
+ </scm>
+ <mailingLists>
+ <mailingList>
+ <name> Spring Forum
+ </name>
+ <post>http://forum.springframework.org</post>
+ <archive>http://forum.springframework.org</archive>
+ </mailingList>
+ </mailingLists>
+
+ <profiles>
+ <profile>
+ <id>staging</id>
+ <distributionManagement>
+ <site>
+ <id>staging</id>
+ <url>file:///${user.dir}/target/staging</url>
+ </site>
+ <repository>
+ <id>staging</id>
+ <url>file:///${user.dir}/target/staging</url>
+ </repository>
+ <snapshotRepository>
+ <id>staging</id>
+ <url>file:///${user.dir}/target/staging</url>
+ </snapshotRepository>
+ </distributionManagement>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-asm</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aspects</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-expression</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jms</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-orm</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-oxm</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc-portlet</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>aopalliance</groupId>
+ <artifactId>aopalliance</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+</project> | true |
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.spring-parent/pom.xml | @@ -14,7 +14,7 @@
<artifactId>spring-parent</artifactId>
<packaging>pom</packaging>
<name>Spring Framework - Parent</name>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
<description>Spring Framework Parent</description>
<scm>
<url>https://fisheye.springframework.org/browse/spring-framework</url> | true |
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.test/pom.xml | @@ -4,12 +4,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<packaging>jar</packaging>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
<parent>
<groupId>org.springframework</groupId>
<artifactId>spring-parent</artifactId>
<relativePath>../org.springframework.spring-parent</relativePath>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
</parent>
<dependencies> | true |
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.transaction/pom.xml | @@ -4,12 +4,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<packaging>jar</packaging>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
<parent>
<groupId>org.springframework</groupId>
<artifactId>spring-parent</artifactId>
<relativePath>../org.springframework.spring-parent</relativePath>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
</parent>
<dependencies> | true |
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.web.portlet/pom.xml | @@ -4,12 +4,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<packaging>jar</packaging>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
<parent>
<groupId>org.springframework</groupId>
<artifactId>spring-parent</artifactId>
<relativePath>../org.springframework.spring-parent</relativePath>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
</parent>
<dependencies> | true |
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.web.servlet/pom.xml | @@ -6,12 +6,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<packaging>jar</packaging>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
<parent>
<groupId>org.springframework</groupId>
<artifactId>spring-parent</artifactId>
<relativePath>../org.springframework.spring-parent</relativePath>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
</parent>
<profiles> | true |
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.web.struts/pom.xml | @@ -6,12 +6,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-struts</artifactId>
<packaging>jar</packaging>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
<parent>
<groupId>org.springframework</groupId>
<artifactId>spring-parent</artifactId>
<relativePath>../org.springframework.spring-parent</relativePath>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
</parent>
<dependencies>
<dependency> | true |
Other | spring-projects | spring-framework | eb7f8309e241020f5058e9dceee909d33c843607.json | Update version in POMs to 3.0.3 | org.springframework.web/pom.xml | @@ -6,12 +6,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<packaging>jar</packaging>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
<parent>
<groupId>org.springframework</groupId>
<artifactId>spring-parent</artifactId>
<relativePath>../org.springframework.spring-parent</relativePath>
- <version>3.0.2.BUILD-SNAPSHOT</version>
+ <version>3.0.3.BUILD-SNAPSHOT</version>
</parent>
<dependencies> | true |
Other | spring-projects | spring-framework | 21b4526063f15aa3eedd407291bca12e3cd10303.json | accept UrlMap with any value type | org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/SimpleUrlHandlerMapping.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2010 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.
@@ -78,7 +78,7 @@ public void setMappings(Properties mappings) {
* @param urlMap map with URLs as keys and beans as values
* @see #setMappings
*/
- public void setUrlMap(Map<String, Object> urlMap) {
+ public void setUrlMap(Map<String, ?> urlMap) {
this.urlMap.putAll(urlMap);
}
@@ -89,7 +89,7 @@ public void setUrlMap(Map<String, Object> urlMap) {
* This is particularly useful for adding or overriding entries in child
* bean definitions.
*/
- public Map getUrlMap() {
+ public Map<String, ?> getUrlMap() {
return this.urlMap;
}
| false |
Other | spring-projects | spring-framework | 3e5c6306bef9b7d146818af26f2845027c05f67d.json | Polish @EnableAsync Javadoc and related XSD | org.springframework.aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java | @@ -25,12 +25,13 @@
import org.springframework.scheduling.annotation.EnableAsync;
/**
- * Enables AspectJ-based asynchronous method execution.
+ * {@code @Configuration} class that registers the Spring infrastructure beans necessary
+ * to enable AspectJ-based asynchronous method execution.
*
* @author Chris Beams
* @since 3.1
* @see EnableAsync
- * @see EnableAsync#mode
+ * @see AsyncConfigurationSelector
*/
@Configuration
public class AspectJAsyncConfiguration extends AbstractAsyncConfiguration { | true |
Other | spring-projects | spring-framework | 3e5c6306bef9b7d146818af26f2845027c05f67d.json | Polish @EnableAsync Javadoc and related XSD | org.springframework.context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java | @@ -27,8 +27,8 @@
import org.springframework.util.Assert;
/**
- * Abstract base class providing common structure for enabling Spring's asynchronous
- * method execution capability.
+ * Abstract base {@code Configuration} class providing common structure for enabling
+ * Spring's asynchronous method execution capability.
*
* @author Chris Beams
* @since 3.1 | true |
Other | spring-projects | spring-framework | 3e5c6306bef9b7d146818af26f2845027c05f67d.json | Polish @EnableAsync Javadoc and related XSD | org.springframework.context/src/main/java/org/springframework/scheduling/annotation/AsyncConfigurationSelector.java | @@ -25,7 +25,7 @@
import org.springframework.util.Assert;
/**
- * Select which implementation of {@link AbstractAsyncConfiguration}
+ * Selects which implementation of {@link AbstractAsyncConfiguration}
* should be used based on the value of {@link EnableAsync#mode} on the
* importing @{@link Configuration} class.
* | true |
Other | spring-projects | spring-framework | 3e5c6306bef9b7d146818af26f2845027c05f67d.json | Polish @EnableAsync Javadoc and related XSD | org.springframework.context/src/main/java/org/springframework/scheduling/annotation/AsyncConfigurer.java | @@ -19,11 +19,11 @@
import java.util.concurrent.Executor;
/**
- * Interface to be implemented by @{@link Configuration} classes
- * annotated with @{@link EnableAsync} that wish to customize the
+ * Interface to be implemented by @{@link org.springframework.context.annotation.Configuration
+ * Configuration} classes annotated with @{@link EnableAsync} that wish to customize the
* {@link Executor} instance used when processing async method invocations.
*
- * <p>See {@link EnableAsync} for usage examples.
+ * <p>See @{@link EnableAsync} for usage examples.
*
* @author Chris Beams
* @since 3.1 | true |
Other | spring-projects | spring-framework | 3e5c6306bef9b7d146818af26f2845027c05f67d.json | Polish @EnableAsync Javadoc and related XSD | org.springframework.context/src/main/java/org/springframework/scheduling/annotation/EnableAsync.java | @@ -29,8 +29,9 @@
import org.springframework.core.Ordered;
/**
- * Enables Spring's asynchronous method execution capability. To be used
- * on @{@link Configuration} classes as follows:
+ * Enables Spring's asynchronous method execution capability, similar to functionality
+ * found in Spring's {@code <task:*>} XML namespace. To be used on @{@link Configuration}
+ * classes as follows:
*
* <pre class="code">
* @Configuration
@@ -42,12 +43,17 @@
* }
* }</pre>
*
- * <p>The various attributes of the annotation control how advice
- * is applied ({@link #mode()}), and if the mode is {@link AdviceMode#PROXY}
- * (the default), the other attributes control the behavior of the proxying.
+ * where {@code MyAsyncBean} is a user-defined type with one or methods annotated
+ * with @{@link Async} (or any custom annotation specified by the {@link #annotation()}
+ * attribute).
*
- * <p>Note that if the {@linkplain #mode} is set to {@link AdviceMode#ASPECTJ}
- * the {@code org.springframework.aspects} module must be present on the classpath.
+ * <p>The {@link #mode()} attribute controls how advice is applied; if the mode is
+ * {@link AdviceMode#PROXY} (the default), then the other attributes control the behavior
+ * of the proxying.
+ *
+ * <p>Note that if the {@linkplain #mode} is set to {@link AdviceMode#ASPECTJ}, then
+ * the {@link #proxyTargetClass()} attribute is obsolete. Note also that in this case the
+ * {@code spring-aspects} module JAR must be present on the classpath.
*
* <p>By default, a {@link org.springframework.core.task.SimpleAsyncTaskExecutor
* SimpleAsyncTaskExecutor} will be used to process async method invocations. To
@@ -68,12 +74,30 @@
* @Override
* public Executor getAsyncExecutor() {
* ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- * executor.setThreadNamePrefix("Custom-");
+ * executor.setCorePoolSize(7);
+ * executor.setMaxPoolSize(42);
+ * executor.setQueueCapacity(11);
+ * executor.setThreadNamePrefix("MyExecutor-");
* executor.initialize();
* return executor;
* }
* }</pre>
*
+ * <p>For reference, the example above can be compared to the following Spring XML
+ * configuration:
+ * <pre class="code">
+ * {@code
+ * <beans>
+ * <task:annotation-config executor="myExecutor"/>
+ * <task:executor id="myExecutor" pool-size="7-42" queue-capacity="11"/>
+ * <bean id="asyncBean" class="com.foo.MyAsyncBean"/>
+ * </beans>
+ * }</pre>
+ * the examples are equivalent save the setting of the <em>thread name prefix</em> of the
+ * Executor; this is because the the {@code task:} namespace {@code executor} element does
+ * not expose such an attribute. This demonstrates how the code-based approach allows for
+ * maximum configurability through direct access to actual componentry.<p>
+ *
* @author Chris Beams
* @since 3.1
* @see Async
@@ -97,10 +121,11 @@
Class<? extends Annotation> annotation() default Annotation.class;
/**
- * Indicate whether class-based (CGLIB) proxies are to be created as opposed
- * to standard Java interface-based proxies. The default is {@code false}
+ * Indicate whether subclass-based (CGLIB) proxies are to be created as opposed
+ * to standard Java interface-based proxies. The default is {@code false}. <strong>
+ * Applicable only if {@link #mode()} is set to {@link AdviceMode#PROXY}</strong>.
*
- * <p>Note: Class-based proxies require the async {@link #annotation()}
+ * <p>Note that subclass-based proxies require the async {@link #annotation()}
* to be defined on the concrete class. Annotations in interfaces will
* not work in that case (they will rather only work with interface-based proxies)!
*/
@@ -115,7 +140,7 @@
/**
* Indicate the order in which the
* {@link org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor}
- * should be applied. Defaults to Order.LOWEST_PRIORITY in order to run
+ * should be applied. The default is {@link Ordered#LOWEST_PRECEDENCE} in order to run
* after all other post-processors, so that it can add an advisor to
* existing proxies rather than double-proxy.
*/ | true |
Other | spring-projects | spring-framework | 3e5c6306bef9b7d146818af26f2845027c05f67d.json | Polish @EnableAsync Javadoc and related XSD | org.springframework.context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java | @@ -27,12 +27,13 @@
import org.springframework.util.Assert;
/**
- * Enables proxy-based asynchronous method execution.
+ * {@code @Configuration} class that registers the Spring infrastructure beans necessary
+ * to enable proxy-based asynchronous method execution.
*
* @author Chris Beams
* @since 3.1
* @see EnableAsync
- * @see EnableAsync#mode
+ * @see AsyncConfigurationSelector
*/
@Configuration
public class ProxyAsyncConfiguration extends AbstractAsyncConfiguration { | true |
Other | spring-projects | spring-framework | 3e5c6306bef9b7d146818af26f2845027c05f67d.json | Polish @EnableAsync Javadoc and related XSD | org.springframework.context/src/main/resources/org/springframework/scheduling/config/spring-task-3.1.xsd | @@ -20,8 +20,13 @@
<xsd:element name="annotation-driven">
<xsd:annotation>
<xsd:documentation><![CDATA[
- Enables the detection of @Async and @Scheduled annotations on any Spring-managed object. If present,
- a proxy will be generated for executing the annotated methods asynchronously.
+ Enables the detection of @Async and @Scheduled annotations on any Spring-managed
+ object. If present, a proxy will be generated for executing the annotated methods
+ asynchronously.
+
+ See Javadoc for the org.springframework.scheduling.annotation.EnableAsync and
+ org.springframework.scheduling.annotation.EnableScheduling annotations for information
+ on code-based alternatives to this XML element.
]]></xsd:documentation>
</xsd:annotation>
<xsd:complexType>
@@ -77,6 +82,9 @@
<xsd:documentation><![CDATA[
Defines a ThreadPoolTaskExecutor instance with configurable pool size,
queue-capacity, keep-alive, and rejection-policy values.
+
+ See Javadoc for the org.springframework.scheduling.annotation.EnableAsync annotation
+ for information on code-based alternatives to this XML element.
]]></xsd:documentation>
</xsd:annotation>
<xsd:complexType> | true |
Other | spring-projects | spring-framework | 8227cb624308e68c34cc2140ea63e8fc4f5cbd9f.json | Introduce ConfigurableConversionService interface
Consolidates ConversionService and ConverterRegistry interfaces;
implemented by GenericConversionService.
ConfigurablePropertyResolver#getConversionService now returns this
new type (hence so too does
ConfigurableEnvironment#getConversionService). This allows for
convenient addition / removal of Converter instances from Environment's
existing ConversionService. For example:
ConfigurableApplicationContext ctx = new ...
ConfigurableEnvironment env = ctx.getEnvironment();
env.getConversionService().addConverter(new FooConverter());
Issue: SPR-8389 | org.springframework.core/src/main/java/org/springframework/core/convert/support/ConfigurableConversionService.java | @@ -0,0 +1,39 @@
+/*
+ * Copyright 2002-2011 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.springframework.core.convert.support;
+
+import org.springframework.core.convert.ConversionService;
+import org.springframework.core.convert.converter.ConverterRegistry;
+
+/**
+ * Configuration interface to be implemented by most if not all {@link ConversionService}
+ * types. Consolidates the read-only operations exposed by {@link ConversionService} and
+ * the mutating operations of {@link ConverterRegistry} to allow for convenient ad-hoc
+ * addition and removal of {@link org.springframework.core.convert.converter.Converter
+ * Converters} through. The latter is particularly useful when working against a
+ * {@link org.springframework.core.env.ConfigurableEnvironment ConfigurableEnvironment}
+ * instance in application context bootstrapping code.
+ *
+ * @author Chris Beams
+ * @since 3.1
+ * @see org.springframework.core.env.ConfigurablePropertyResolver#getConversionService()
+ * @see org.springframework.core.env.ConfigurableEnvironment
+ * @see org.springframework.context.ConfigurableApplicationContext#getEnvironment()
+ */
+public interface ConfigurableConversionService extends ConversionService, ConverterRegistry {
+
+} | true |
Other | spring-projects | spring-framework | 8227cb624308e68c34cc2140ea63e8fc4f5cbd9f.json | Introduce ConfigurableConversionService interface
Consolidates ConversionService and ConverterRegistry interfaces;
implemented by GenericConversionService.
ConfigurablePropertyResolver#getConversionService now returns this
new type (hence so too does
ConfigurableEnvironment#getConversionService). This allows for
convenient addition / removal of Converter instances from Environment's
existing ConversionService. For example:
ConfigurableApplicationContext ctx = new ...
ConfigurableEnvironment env = ctx.getEnvironment();
env.getConversionService().addConverter(new FooConverter());
Issue: SPR-8389 | org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java | @@ -47,13 +47,15 @@
/**
* Base {@link ConversionService} implementation suitable for use in most environments.
- * Implements {@link ConverterRegistry} as registration API.
+ * Indirectly implements {@link ConverterRegistry} as registration API through the
+ * {@link ConfigurableConversionService} interface.
*
* @author Keith Donald
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 3.0
*/
-public class GenericConversionService implements ConversionService, ConverterRegistry {
+public class GenericConversionService implements ConfigurableConversionService {
private static final GenericConverter NO_OP_CONVERTER = new GenericConverter() {
public Set<ConvertiblePair> getConvertibleTypes() { | true |
Other | spring-projects | spring-framework | 8227cb624308e68c34cc2140ea63e8fc4f5cbd9f.json | Introduce ConfigurableConversionService interface
Consolidates ConversionService and ConverterRegistry interfaces;
implemented by GenericConversionService.
ConfigurablePropertyResolver#getConversionService now returns this
new type (hence so too does
ConfigurableEnvironment#getConversionService). This allows for
convenient addition / removal of Converter instances from Environment's
existing ConversionService. For example:
ConfigurableApplicationContext ctx = new ...
ConfigurableEnvironment env = ctx.getEnvironment();
env.getConversionService().addConverter(new FooConverter());
Issue: SPR-8389 | org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java | @@ -29,7 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.core.convert.ConversionService;
+import org.springframework.core.convert.support.ConfigurableConversionService;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -356,11 +356,11 @@ public String resolveRequiredPlaceholders(String text) throws IllegalArgumentExc
return this.propertyResolver.resolveRequiredPlaceholders(text);
}
- public void setConversionService(ConversionService conversionService) {
+ public void setConversionService(ConfigurableConversionService conversionService) {
this.propertyResolver.setConversionService(conversionService);
}
- public ConversionService getConversionService() {
+ public ConfigurableConversionService getConversionService() {
return this.propertyResolver.getConversionService();
}
| true |
Other | spring-projects | spring-framework | 8227cb624308e68c34cc2140ea63e8fc4f5cbd9f.json | Introduce ConfigurableConversionService interface
Consolidates ConversionService and ConverterRegistry interfaces;
implemented by GenericConversionService.
ConfigurablePropertyResolver#getConversionService now returns this
new type (hence so too does
ConfigurableEnvironment#getConversionService). This allows for
convenient addition / removal of Converter instances from Environment's
existing ConversionService. For example:
ConfigurableApplicationContext ctx = new ...
ConfigurableEnvironment env = ctx.getEnvironment();
env.getConversionService().addConverter(new FooConverter());
Issue: SPR-8389 | org.springframework.core/src/main/java/org/springframework/core/env/AbstractPropertyResolver.java | @@ -26,7 +26,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.core.convert.ConversionService;
+import org.springframework.core.convert.support.ConfigurableConversionService;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.util.PropertyPlaceholderHelper;
import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver;
@@ -41,7 +41,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
protected final Log logger = LogFactory.getLog(getClass());
- protected ConversionService conversionService = new DefaultConversionService();
+ protected ConfigurableConversionService conversionService = new DefaultConversionService();
private PropertyPlaceholderHelper nonStrictHelper;
private PropertyPlaceholderHelper strictHelper;
@@ -52,11 +52,11 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
private final Set<String> requiredProperties = new LinkedHashSet<String>();
- public ConversionService getConversionService() {
+ public ConfigurableConversionService getConversionService() {
return this.conversionService;
}
- public void setConversionService(ConversionService conversionService) {
+ public void setConversionService(ConfigurableConversionService conversionService) {
this.conversionService = conversionService;
}
| true |
Other | spring-projects | spring-framework | 8227cb624308e68c34cc2140ea63e8fc4f5cbd9f.json | Introduce ConfigurableConversionService interface
Consolidates ConversionService and ConverterRegistry interfaces;
implemented by GenericConversionService.
ConfigurablePropertyResolver#getConversionService now returns this
new type (hence so too does
ConfigurableEnvironment#getConversionService). This allows for
convenient addition / removal of Converter instances from Environment's
existing ConversionService. For example:
ConfigurableApplicationContext ctx = new ...
ConfigurableEnvironment env = ctx.getEnvironment();
env.getConversionService().addConverter(new FooConverter());
Issue: SPR-8389 | org.springframework.core/src/main/java/org/springframework/core/env/ConfigurablePropertyResolver.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,33 +16,45 @@
package org.springframework.core.env;
-import org.springframework.core.convert.ConversionService;
-
+import org.springframework.core.convert.support.ConfigurableConversionService;
/**
* Configuration interface to be implemented by most if not all {@link PropertyResolver
* PropertyResolvers}. Provides facilities for accessing and customizing the
- * {@link ConversionService} used when converting property values from one type to
- * another.
+ * {@link org.springframework.core.convert.ConversionService ConversionService} used when
+ * converting property values from one type to another.
*
* @author Chris Beams
* @since 3.1
*/
public interface ConfigurablePropertyResolver extends PropertyResolver {
/**
- * @return the {@link ConversionService} used when performing type
+ * @return the {@link ConfigurableConversionService} used when performing type
* conversions on properties.
+ * <p>The configurable nature of the returned conversion service allows for
+ * the convenient addition and removal of individual {@code Converter} instances:
+ * <pre class="code">
+ * ConfigurableConversionService cs = env.getConversionService();
+ * cs.addConverter(new FooConverter());
+ * </pre>
* @see PropertyResolver#getProperty(String, Class)
+ * @see org.springframework.core.convert.converter.ConverterRegistry#addConverter
*/
- ConversionService getConversionService();
+ ConfigurableConversionService getConversionService();
/**
- * Set the {@link ConversionService} to be used when performing type
+ * Set the {@link ConfigurableConversionService} to be used when performing type
* conversions on properties.
+ * <p><strong>Note:</strong> as an alternative to fully replacing the {@code
+ * ConversionService}, consider adding or removing individual {@code Converter}
+ * intstances by drilling into {@link #getConversionService()} and calling methods
+ * such as {@code #addConverter}.
* @see PropertyResolver#getProperty(String, Class)
+ * @see #getConversionService()
+ * @see org.springframework.core.convert.converter.ConverterRegistry#addConverter
*/
- void setConversionService(ConversionService conversionService);
+ void setConversionService(ConfigurableConversionService conversionService);
/**
* Set the prefix that placeholders replaced by this resolver must begin with. | true |
Other | spring-projects | spring-framework | 67661693fe30a9ad173239fdcf620a23f19f5ed8.json | Ignore failing tests on Windows
Attempt to access and modify the system environment works on OS X /
Linux but not under Windows. Does not represent any real failure for
production code - the need to modify the system environment is a
testing concern only, and one we can probably live without, considering
the losing battle necessary to make such a hack cross-platform.
Issue: SPR-8245 | org.springframework.beans/src/test/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurerTests.java | @@ -31,6 +31,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -228,6 +229,7 @@ public void customPlaceholderPrefixAndSuffix() {
assertThat(bf.getBean(TestBean.class).getSex(), is("${key2}"));
}
+ @Ignore // fails on windows
@Test
public void nullValueIsPreserved() {
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); | true |
Other | spring-projects | spring-framework | 67661693fe30a9ad173239fdcf620a23f19f5ed8.json | Ignore failing tests on Windows
Attempt to access and modify the system environment works on OS X /
Linux but not under Windows. Does not represent any real failure for
production code - the need to modify the system environment is a
testing concern only, and one we can probably live without, considering
the losing battle necessary to make such a hack cross-platform.
Issue: SPR-8245 | org.springframework.core/src/test/java/org/springframework/core/env/EnvironmentTests.java | @@ -39,6 +39,7 @@
import java.util.Collections;
import java.util.Map;
+import org.junit.Ignore;
import org.junit.Test;
import org.springframework.mock.env.MockPropertySource;
@@ -174,6 +175,7 @@ public void acceptsProfiles_defaultProfile() {
assertThat(environment.acceptsProfiles("p1"), is(true));
}
+ @Ignore // fails on windows
@Test
public void getSystemProperties_withAndWithoutSecurityManager() {
System.setProperty(ALLOWED_PROPERTY_NAME, ALLOWED_PROPERTY_VALUE);
@@ -291,8 +293,6 @@ public void checkPermission(Permission perm) {
@SuppressWarnings("unchecked")
private static Map<String, String> getModifiableSystemEnvironment() {
-
- // for os x / linux
Class<?>[] classes = Collections.class.getDeclaredClasses();
Map<String, String> env = System.getenv();
for (Class<?> cl : classes) {
@@ -301,45 +301,12 @@ private static Map<String, String> getModifiableSystemEnvironment() {
Field field = cl.getDeclaredField("m");
field.setAccessible(true);
Object obj = field.get(env);
- if (obj != null) {
- return (Map<String, String>) obj;
- }
+ return (Map<String, String>) obj;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}
-
- // for windows
- Class<?> processEnvironmentClass;
- try {
- processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment");
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- try {
- Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment");
- theCaseInsensitiveEnvironmentField.setAccessible(true);
- Object obj = theCaseInsensitiveEnvironmentField.get(null);
- return (Map<String, String>) obj;
- } catch (NoSuchFieldException e) {
- // do nothing
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- try {
- Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment");
- theEnvironmentField.setAccessible(true);
- Object obj = theEnvironmentField.get(null);
- return (Map<String, String>) obj;
- } catch (NoSuchFieldException e) {
- // do nothing
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
throw new IllegalStateException();
}
} | true |
Other | spring-projects | spring-framework | 948aa4f589c65581a6d294095670cb83b65297da.json | Introduce DelegatingFilterProxy constructors
Issue: SPR-7672 | org.springframework.web/src/main/java/org/springframework/web/filter/DelegatingFilterProxy.java | @@ -23,6 +23,8 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.util.Assert;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
@@ -50,22 +52,38 @@
* of the {@code Filter.init} and {@code Filter.destroy} lifecycle methods
* on the target bean, letting the servlet container manage the filter lifecycle.
*
- * <p>This class is inspired by Acegi Security's FilterToBeanProxy class,
- * written by Ben Alex.
+ * <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally accept
+ * constructor parameters when using Servlet 3.0's instance-based filter registration
+ * methods, usually in conjunction with Spring 3.1's
+ * {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow
+ * for providing the delegate Filter bean directly, or providing the application context
+ * and bean name to fetch, avoiding the need to look up the application context from the
+ * ServletContext.
+ *
+ * <p>This class was originally inspired by Spring Security's {@code FilterToBeanProxy}
+ * class, written by Ben Alex.
*
* @author Juergen Hoeller
* @author Sam Brannen
+ * @author Chris Beams
* @since 1.2
* @see #setTargetBeanName
* @see #setTargetFilterLifecycle
* @see javax.servlet.Filter#doFilter
* @see javax.servlet.Filter#init
* @see javax.servlet.Filter#destroy
+ * @see #DelegatingFilterProxy(Filter)
+ * @see #DelegatingFilterProxy(String)
+ * @see #DelegatingFilterProxy(String, WebApplicationContext)
+ * @see javax.servlet.ServletContext#addFilter(String, Filter)
+ * @see org.springframework.web.WebApplicationInitializer
*/
public class DelegatingFilterProxy extends GenericFilterBean {
private String contextAttribute;
+ private WebApplicationContext webApplicationContext;
+
private String targetBeanName;
private boolean targetFilterLifecycle = false;
@@ -75,6 +93,78 @@ public class DelegatingFilterProxy extends GenericFilterBean {
private final Object delegateMonitor = new Object();
+ /**
+ * Create a new {@code DelegatingFilterProxy}. For traditional (pre-Servlet 3.0) use
+ * in {@code web.xml}.
+ * @see #setTargetBeanName(String)
+ */
+ public DelegatingFilterProxy() {
+ }
+
+ /**
+ * Create a new {@code DelegatingFilterProxy} with the given {@link Filter} delegate.
+ * Bypasses entirely the need for interacting with a Spring application context,
+ * specifying the {@linkplain #setTargetBeanName target bean name}, etc.
+ * <p>For use in Servlet 3.0+ environments where instance-based registration of
+ * filters is supported.
+ * @param delegate the {@code Filter} instance that this proxy will delegate to and
+ * manage the lifecycle for (must not be {@code null}).
+ * @see #doFilter(ServletRequest, ServletResponse, FilterChain)
+ * @see #invokeDelegate(Filter, ServletRequest, ServletResponse, FilterChain)
+ * @see #destroy()
+ * @see #setEnvironment(org.springframework.core.env.Environment)
+ */
+ public DelegatingFilterProxy(Filter delegate) {
+ Assert.notNull(delegate, "delegate Filter object must not be null");
+ this.delegate = delegate;
+ }
+
+ /**
+ * Create a new {@code DelegatingFilterProxy} that will retrieve the named target
+ * bean from the Spring {@code WebApplicationContext} found in the {@code ServletContext}
+ * (either the 'root' application context or the context named by
+ * {@link #setContextAttribute}).
+ * <p>For use in Servlet 3.0+ environments where instance-based registration of
+ * filters is supported.
+ * <p>The target bean must implement the standard Servlet Filter.
+ * @param targetBeanName name of the target filter bean to look up in the Spring
+ * application context (must not be {@code null}).
+ * @see #findWebApplicationContext()
+ * @see #setEnvironment(org.springframework.core.env.Environment)
+ */
+ public DelegatingFilterProxy(String targetBeanName) {
+ this(targetBeanName, null);
+ }
+
+ /**
+ * Create a new {@code DelegatingFilterProxy} that will retrieve the named target
+ * bean from the given Spring {@code WebApplicationContext}.
+ * <p>For use in Servlet 3.0+ environments where instance-based registration of
+ * filters is supported.
+ * <p>The target bean must implement the standard Servlet Filter interface.
+ * <p>The given {@code WebApplicationContext} may or may not be refreshed when passed
+ * in. If it has not, and if the context implements {@link ConfigurableApplicationContext},
+ * a {@link ConfigurableApplicationContext#refresh() refresh()} will be attempted before
+ * retrieving the named target bean.
+ * <p>This proxy's {@code Environment} will be inherited from the given
+ * {@code WebApplicationContext}.
+ * @param targetBeanName name of the target filter bean in the Spring application
+ * context (must not be {@code null}).
+ * @param wac the application context from which the target filter will be retrieved;
+ * if {@code null}, an application context will be looked up from {@code ServletContext}
+ * as a fallback.
+ * @see #findWebApplicationContext()
+ * @see #setEnvironment(org.springframework.core.env.Environment)
+ */
+ public DelegatingFilterProxy(String targetBeanName, WebApplicationContext wac) {
+ Assert.hasText(targetBeanName, "target Filter bean name must not be null or empty");
+ this.setTargetBeanName(targetBeanName);
+ this.webApplicationContext = wac;
+ if (wac != null) {
+ this.setEnvironment(wac.getEnvironment());
+ }
+ }
+
/**
* Set the name of the ServletContext attribute which should be used to retrieve the
* {@link WebApplicationContext} from which to load the delegate {@link Filter} bean.
@@ -131,18 +221,20 @@ protected boolean isTargetFilterLifecycle() {
@Override
protected void initFilterBean() throws ServletException {
- // If no target bean name specified, use filter name.
- if (this.targetBeanName == null) {
- this.targetBeanName = getFilterName();
- }
-
- // Fetch Spring root application context and initialize the delegate early,
- // if possible. If the root application context will be started after this
- // filter proxy, we'll have to resort to lazy initialization.
synchronized (this.delegateMonitor) {
- WebApplicationContext wac = findWebApplicationContext();
- if (wac != null) {
- this.delegate = initDelegate(wac);
+ if (this.delegate == null) {
+ // If no target bean name specified, use filter name.
+ if (this.targetBeanName == null) {
+ this.targetBeanName = getFilterName();
+ }
+
+ // Fetch Spring root application context and initialize the delegate early,
+ // if possible. If the root application context will be started after this
+ // filter proxy, we'll have to resort to lazy initialization.
+ WebApplicationContext wac = findWebApplicationContext();
+ if (wac != null) {
+ this.delegate = initDelegate(wac);
+ }
}
}
}
@@ -180,16 +272,33 @@ public void destroy() {
/**
- * Retrieve a <code>WebApplicationContext</code> from the <code>ServletContext</code>
- * attribute with the {@link #setContextAttribute configured name}. The
- * <code>WebApplicationContext</code> must have already been loaded and stored in the
- * <code>ServletContext</code> before this filter gets initialized (or invoked).
+ * Return the {@code WebApplicationContext} passed in at construction time, if available.
+ * Otherwise, attempt to retrieve a {@code WebApplicationContext} from the
+ * {@code ServletContext} attribute with the {@linkplain #setContextAttribute
+ * configured name} if set. Otherwise look up a {@code WebApplicationContext} under
+ * the well-known "root" application context attribute. The
+ * {@code WebApplicationContext} must have already been loaded and stored in the
+ * {@code ServletContext} before this filter gets initialized (or invoked).
* <p>Subclasses may override this method to provide a different
- * <code>WebApplicationContext</code> retrieval strategy.
- * @return the WebApplicationContext for this proxy, or <code>null</code> if not found
+ * {@code WebApplicationContext} retrieval strategy.
+ * @return the {@code WebApplicationContext} for this proxy, or {@code null} if not
+ * found
+ * @see #DelegatingFilterProxy(String, WebApplicationContext)
* @see #getContextAttribute()
+ * @see WebApplicationContextUtils#getWebApplicationContext(javax.servlet.ServletContext)
+ * @see WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
*/
protected WebApplicationContext findWebApplicationContext() {
+ if (this.webApplicationContext != null) {
+ // the user has injected a context at construction time -> use it
+ if (this.webApplicationContext instanceof ConfigurableApplicationContext) {
+ if (!((ConfigurableApplicationContext)this.webApplicationContext).isActive()) {
+ // the context has not yet been refreshed -> do so before returning it
+ ((ConfigurableApplicationContext)this.webApplicationContext).refresh();
+ }
+ }
+ return this.webApplicationContext;
+ }
String attrName = getContextAttribute();
if (attrName != null) {
return WebApplicationContextUtils.getWebApplicationContext(getServletContext(), attrName); | true |
Other | spring-projects | spring-framework | 948aa4f589c65581a6d294095670cb83b65297da.json | Introduce DelegatingFilterProxy constructors
Issue: SPR-7672 | org.springframework.web/src/test/java/org/springframework/web/filter/DelegatingFilterProxyTests.java | @@ -1,4 +1,6 @@
-/* Copyright 2004, 2005 Acegi Technology Pty Limited
+/*
+ * Copyright 2004, 2005 Acegi Technology Pty Limited
+ * Copyright 2006-2011 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.
@@ -25,8 +27,8 @@
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import junit.framework.TestCase;
-
+import static org.junit.Assert.*;
+import org.junit.Test;
import org.springframework.mock.web.MockFilterConfig;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -36,10 +38,12 @@
/**
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 08.05.2005
*/
-public class DelegatingFilterProxyTests extends TestCase {
+public class DelegatingFilterProxyTests {
+ @Test
public void testDelegatingFilterProxy() throws ServletException, IOException {
ServletContext sc = new MockServletContext();
@@ -67,6 +71,118 @@ public void testDelegatingFilterProxy() throws ServletException, IOException {
assertNull(targetFilter.filterConfig);
}
+ @Test
+ public void testDelegatingFilterProxyAndCustomContextAttribute() throws ServletException, IOException {
+ ServletContext sc = new MockServletContext();
+
+ StaticWebApplicationContext wac = new StaticWebApplicationContext();
+ wac.setServletContext(sc);
+ wac.registerSingleton("targetFilter", MockFilter.class);
+ wac.refresh();
+ sc.setAttribute("CUSTOM_ATTR", wac);
+
+ MockFilter targetFilter = (MockFilter) wac.getBean("targetFilter");
+
+ MockFilterConfig proxyConfig = new MockFilterConfig(sc);
+ proxyConfig.addInitParameter("targetBeanName", "targetFilter");
+ proxyConfig.addInitParameter("contextAttribute", "CUSTOM_ATTR");
+ DelegatingFilterProxy filterProxy = new DelegatingFilterProxy();
+ filterProxy.init(proxyConfig);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ filterProxy.doFilter(request, response, null);
+
+ assertNull(targetFilter.filterConfig);
+ assertEquals(Boolean.TRUE, request.getAttribute("called"));
+
+ filterProxy.destroy();
+ assertNull(targetFilter.filterConfig);
+ }
+
+ @Test
+ public void testDelegatingFilterProxyWithFilterDelegateInstance() throws ServletException, IOException {
+ MockFilter targetFilter = new MockFilter();
+
+ DelegatingFilterProxy filterProxy = new DelegatingFilterProxy(targetFilter);
+ filterProxy.init(new MockFilterConfig(new MockServletContext()));
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ filterProxy.doFilter(request, response, null);
+
+ assertNull(targetFilter.filterConfig);
+ assertEquals(Boolean.TRUE, request.getAttribute("called"));
+
+ filterProxy.destroy();
+ assertNull(targetFilter.filterConfig);
+ }
+
+ @Test
+ public void testDelegatingFilterProxyWithTargetBeanName() throws ServletException, IOException {
+ MockServletContext sc = new MockServletContext();
+
+ StaticWebApplicationContext wac = new StaticWebApplicationContext();
+ wac.setServletContext(sc);
+ wac.registerSingleton("targetFilter", MockFilter.class);
+ wac.refresh();
+ sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
+
+ MockFilter targetFilter = (MockFilter) wac.getBean("targetFilter");
+
+ DelegatingFilterProxy filterProxy = new DelegatingFilterProxy("targetFilter");
+ filterProxy.init(new MockFilterConfig(sc));
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ filterProxy.doFilter(request, response, null);
+
+ assertNull(targetFilter.filterConfig);
+ assertEquals(Boolean.TRUE, request.getAttribute("called"));
+
+ filterProxy.destroy();
+ assertNull(targetFilter.filterConfig);
+ }
+
+ @Test
+ public void testDelegatingFilterProxyWithTargetBeanNameAndNotYetRefreshedApplicationContext() throws ServletException, IOException {
+ MockServletContext sc = new MockServletContext();
+
+ StaticWebApplicationContext wac = new StaticWebApplicationContext();
+ wac.setServletContext(sc);
+ wac.registerSingleton("targetFilter", MockFilter.class);
+ // wac.refresh();
+ // note that the context is not set as the ROOT attribute in the ServletContext!
+
+ DelegatingFilterProxy filterProxy = new DelegatingFilterProxy("targetFilter", wac);
+ filterProxy.init(new MockFilterConfig(sc));
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ filterProxy.doFilter(request, response, null);
+
+ MockFilter targetFilter = (MockFilter) wac.getBean("targetFilter");
+
+ assertNull(targetFilter.filterConfig);
+ assertEquals(Boolean.TRUE, request.getAttribute("called"));
+
+ filterProxy.destroy();
+ assertNull(targetFilter.filterConfig);
+ }
+
+ @Test(expected=IllegalStateException.class)
+ public void testDelegatingFilterProxyWithTargetBeanNameAndNoApplicationContext() throws ServletException, IOException {
+ MockServletContext sc = new MockServletContext();
+
+ DelegatingFilterProxy filterProxy = new DelegatingFilterProxy("targetFilter", null);
+ filterProxy.init(new MockFilterConfig(sc));
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ filterProxy.doFilter(request, response, null); // throws
+ }
+
+ @Test
public void testDelegatingFilterProxyWithFilterName() throws ServletException, IOException {
ServletContext sc = new MockServletContext();
@@ -93,6 +209,7 @@ public void testDelegatingFilterProxyWithFilterName() throws ServletException, I
assertNull(targetFilter.filterConfig);
}
+ @Test
public void testDelegatingFilterProxyWithLazyContextStartup() throws ServletException, IOException {
ServletContext sc = new MockServletContext();
@@ -120,6 +237,7 @@ public void testDelegatingFilterProxyWithLazyContextStartup() throws ServletExce
assertNull(targetFilter.filterConfig);
}
+ @Test
public void testDelegatingFilterProxyWithTargetFilterLifecycle() throws ServletException, IOException {
ServletContext sc = new MockServletContext();
| true |
Other | spring-projects | spring-framework | 2b4328023e5e96078f8b7fd6661cb325d34c8f21.json | Improve ApplicationContextInitializer sorting
ContextLoader and FrameworkServlet now use
AnnotationAwareOrderComparator to support @Order usage; previously
supported only implementation of the Ordered interface. | org.springframework.context/src/main/java/org/springframework/context/ApplicationContextInitializer.java | @@ -27,16 +27,16 @@
* for declaring a "contextInitializerClasses" context-param and init-param, respectively.
*
* <p>{@code ApplicationContextInitializer} processors are encouraged to detect
- * whether Spring's {@link org.springframework.core.Ordered Ordered} or
- * {@link org.springframework.core.PriorityOrdered PriorityOrdered} interfaces are also
- * implemented and sort instances accordingly if so prior to invocation.
+ * whether Spring's {@link org.springframework.core.Ordered Ordered} interface has been
+ * implemented or if the @{@link org.springframework.core.annotation.Order Order}
+ * annotation is present and to sort instances accordingly if so prior to invocation.
*
* @author Chris Beams
* @since 3.1
* @see org.springframework.web.context.ContextLoader#customizeContext
* @see org.springframework.web.context.ContextLoader#CONTEXT_INITIALIZER_CLASSES_PARAM
* @see org.springframework.web.servlet.FrameworkServlet#setContextInitializerClasses
- * @see org.springframework.web.servlet.FrameworkServlet#initializeWebApplicationContext
+ * @see org.springframework.web.servlet.FrameworkServlet#applyInitializers
*/
public interface ApplicationContextInitializer<C extends ConfigurableApplicationContext> {
| true |
Other | spring-projects | spring-framework | 2b4328023e5e96078f8b7fd6661cb325d34c8f21.json | Improve ApplicationContextInitializer sorting
ContextLoader and FrameworkServlet now use
AnnotationAwareOrderComparator to support @Order usage; previously
supported only implementation of the Ordered interface. | org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/FrameworkServlet.java | @@ -18,7 +18,8 @@
import java.io.IOException;
import java.security.Principal;
-import java.util.TreeSet;
+import java.util.ArrayList;
+import java.util.Collections;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -184,8 +185,8 @@ public abstract class FrameworkServlet extends HttpServletBean {
private String contextInitializerClasses;
/** Actual ApplicationContextInitializer instances to apply to the context */
- private TreeSet<ApplicationContextInitializer<ConfigurableApplicationContext>> contextInitializers =
- new TreeSet<ApplicationContextInitializer<ConfigurableApplicationContext>>(new AnnotationAwareOrderComparator());
+ private ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>> contextInitializers =
+ new ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>>();
/**
@@ -652,6 +653,8 @@ protected void applyInitializers(ConfigurableApplicationContext wac) {
}
}
+ Collections.sort(this.contextInitializers, new AnnotationAwareOrderComparator());
+
for (ApplicationContextInitializer<ConfigurableApplicationContext> initializer : this.contextInitializers) {
initializer.initialize(wac);
} | true |
Other | spring-projects | spring-framework | 2b4328023e5e96078f8b7fd6661cb325d34c8f21.json | Improve ApplicationContextInitializer sorting
ContextLoader and FrameworkServlet now use
AnnotationAwareOrderComparator to support @Order usage; previously
supported only implementation of the Ordered interface. | org.springframework.web/src/main/java/org/springframework/web/context/ContextLoader.java | @@ -18,6 +18,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -36,8 +37,8 @@
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.access.ContextSingletonBeanFactoryLocator;
import org.springframework.core.GenericTypeResolver;
-import org.springframework.core.OrderComparator;
import org.springframework.core.Ordered;
+import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.util.Assert;
@@ -348,7 +349,7 @@ protected Class<?> determineContextClass(ServletContext servletContext) {
}
catch (ClassNotFoundException ex) {
throw new ApplicationContextException(
- "Failed to load context configurer class [" + className + "]", ex);
+ "Failed to load context initializer class [" + className + "]", ex);
}
}
}
@@ -364,16 +365,17 @@ protected Class<?> determineContextClass(ServletContext servletContext) {
* {@linkplain #CONTEXT_INITIALIZER_CLASSES_PARAM context init parameters} and
* {@linkplain ApplicationContextInitializer#initialize invokes each} with the
* given web application context.
- * <p>Any {@link Ordered} {@code ApplicationContextInitializer} will be sorted
- * appropriately.
+ * <p>Any {@code ApplicationContextInitializers} implementing
+ * {@link org.springframework.core.Ordered Ordered} or marked with @{@link
+ * org.springframework.core.annotation.Order Order} will be sorted appropriately.
* @param servletContext the current servlet context
* @param applicationContext the newly created application context
* @see #createWebApplicationContext(ServletContext, ApplicationContext)
* @see #CONTEXT_INITIALIZER_CLASSES_PARAM
* @see ApplicationContextInitializer#initialize(ConfigurableApplicationContext)
*/
protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
- List<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerInstances =
+ ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerInstances =
new ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>>();
for (Class<ApplicationContextInitializer<ConfigurableApplicationContext>> initializerClass :
@@ -388,7 +390,7 @@ protected void customizeContext(ServletContext servletContext, ConfigurableWebAp
initializerInstances.add(BeanUtils.instantiateClass(initializerClass));
}
- OrderComparator.sort(initializerInstances);
+ Collections.sort(initializerInstances, new AnnotationAwareOrderComparator());
for (ApplicationContextInitializer<ConfigurableApplicationContext> initializer : initializerInstances) {
initializer.initialize(applicationContext); | true |
Other | spring-projects | spring-framework | c4d98278e94d94187e429d33400b7425b128a577.json | Fix DispatcherServlet warnings | org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java | @@ -125,6 +125,7 @@
* @see org.springframework.web.servlet.mvc.Controller
* @see org.springframework.web.context.ContextLoaderListener
*/
+@SuppressWarnings("serial")
public class DispatcherServlet extends FrameworkServlet {
/** Well-known name for the MultipartResolver object in the bean factory for this namespace. */
@@ -647,7 +648,7 @@ protected <T> List<T> getDefaultStrategies(ApplicationContext context, Class<T>
List<T> strategies = new ArrayList<T>(classNames.length);
for (String className : classNames) {
try {
- Class clazz = ClassUtils.forName(className, DispatcherServlet.class.getClassLoader());
+ Class<?> clazz = ClassUtils.forName(className, DispatcherServlet.class.getClassLoader());
Object strategy = createDefaultStrategy(context, clazz);
strategies.add((T) strategy);
}
@@ -700,7 +701,7 @@ protected void doService(HttpServletRequest request, HttpServletResponse respons
if (WebUtils.isIncludeRequest(request)) {
logger.debug("Taking snapshot of request attributes before include");
attributesSnapshot = new HashMap<String, Object>();
- Enumeration attrNames = request.getAttributeNames();
+ Enumeration<?> attrNames = request.getAttributeNames();
while (attrNames.hasMoreElements()) {
String attrName = (String) attrNames.nextElement();
if (this.cleanupAfterInclude || attrName.startsWith("org.springframework.web.servlet")) {
@@ -1120,13 +1121,13 @@ private void triggerAfterCompletion(HandlerExecutionChain mappedHandler,
* @param request current HTTP request
* @param attributesSnapshot the snapshot of the request attributes before the include
*/
- private void restoreAttributesAfterInclude(HttpServletRequest request, Map attributesSnapshot) {
+ private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?,?> attributesSnapshot) {
logger.debug("Restoring snapshot of request attributes after include");
// Need to copy into separate Collection here, to avoid side effects
// on the Enumeration when removing attributes.
Set<String> attrsToCheck = new HashSet<String>();
- Enumeration attrNames = request.getAttributeNames();
+ Enumeration<?> attrNames = request.getAttributeNames();
while (attrNames.hasMoreElements()) {
String attrName = (String) attrNames.nextElement();
if (this.cleanupAfterInclude || attrName.startsWith("org.springframework.web.servlet")) { | false |
Other | spring-projects | spring-framework | fb9fb00c04143480aa39b6538f4d71aba461571b.json | Update GenericWAC to implement ConfigurableWAC
GenericWebApplicationContext now implements
ConfigurableWebApplicationContext in order to be compatible with
Framework/DispatcherServlet and ContextLoader/Listener, especially with
regard to changes in SPR-7672 that allow for programmatic use of these
types within Servlet 3.0+ environments. For the first time, it's now
reasonable to imagine injecting a GWAC into DispatcherServlet; the most
robust way to accommodate this possibility is for GWAC to implement
CWAC.
The implementation is in name only, allowing for interchangable use of
GWAC anywhere, for example, an XWAC could otherwise go. Methods such
as setConfigLocation will throw UnsupportedOperationException if the
configLocation value actually contains text. Other methods are
implemented as no-ops or to throw UOE as appropriate.
Issue: SPR-7672 | org.springframework.web/src/main/java/org/springframework/web/context/support/GenericWebApplicationContext.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,6 +16,7 @@
package org.springframework.web.context.support;
+import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
@@ -27,16 +28,19 @@
import org.springframework.ui.context.Theme;
import org.springframework.ui.context.ThemeSource;
import org.springframework.ui.context.support.UiApplicationContextUtils;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.ServletContextAware;
-import org.springframework.web.context.WebApplicationContext;
/**
* Subclass of {@link GenericApplicationContext}, suitable for web environments.
*
- * <p>Implements the {@link WebApplicationContext} interface, but not
+ * <p>Implements the
* {@link org.springframework.web.context.ConfigurableWebApplicationContext},
- * as it is not intended for declarative setup in <code>web.xml</code>. Instead,
- * it is designed for programmatic setup, for example for building nested contexts.
+ * but is not intended for declarative setup in <code>web.xml</code>. Instead,
+ * it is designed for programmatic setup, for example for building nested contexts or
+ * for use within Spring 3.1 {@link org.springframework.web.WebApplicationInitializer}s.
*
* <p><b>If you intend to implement a WebApplicationContext that reads bean definitions
* from configuration files, consider deriving from AbstractRefreshableWebApplicationContext,
@@ -52,10 +56,11 @@
* this class detects a ThemeSource bean in the context, with the name "themeSource".
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 1.2
*/
public class GenericWebApplicationContext extends GenericApplicationContext
- implements WebApplicationContext, ThemeSource {
+ implements ConfigurableWebApplicationContext, ThemeSource {
private ServletContext servletContext;
@@ -179,4 +184,45 @@ public Theme getTheme(String themeName) {
return this.themeSource.getTheme(themeName);
}
+
+ // ---------------------------------------------------------------------
+ // Pseudo-implementation of ConfigurableWebApplicationContext
+ // ---------------------------------------------------------------------
+
+ public void setServletConfig(ServletConfig servletConfig) {
+ // no-op
+ }
+
+ public ServletConfig getServletConfig() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setNamespace(String namespace) {
+ // no-op
+ }
+
+ public String getNamespace() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setConfigLocation(String configLocation) {
+ if (StringUtils.hasText(configLocation)) {
+ throw new UnsupportedOperationException(
+ "GenericWebApplicationContext does not support configLocation. Do " +
+ "you still have an 'contextConfigLocations' init-param set?");
+ }
+ }
+
+ public void setConfigLocations(String[] configLocations) {
+ if (!ObjectUtils.isEmpty(configLocations)) {
+ throw new UnsupportedOperationException(
+ "GenericWebApplicationContext does not support configLocations. Do " +
+ "you still have an 'contextConfigLocations' init-param set?");
+ }
+ }
+
+ public String[] getConfigLocations() {
+ throw new UnsupportedOperationException();
+ }
+
} | false |
Other | spring-projects | spring-framework | c9e67b2ef25ff1f5de32e4fc75a36f076fd14f35.json | Introduce Servlet 3.0 WebApplicationInitializer
WebApplicationInitializer provides a programmatic alternative to the
traditional WEB-INF/web.xml servlet container deployment descriptor
for Servlet API 3.0+ environments.
This is done by building atop the new ServletContainerInitializer
support in Servlet 3.0. See SpringServletContainerInitializer for
complete details. And see WebApplicationInitializer Javadoc for
typical usage examples.
Issue: SPR-7672 | org.springframework.web/src/main/java/org/springframework/web/SpringServletContainerInitializer.java | @@ -0,0 +1,165 @@
+/*
+ * Copyright 2002-2011 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.springframework.web;
+
+import static org.springframework.beans.BeanUtils.instantiateClass;
+
+import java.lang.reflect.Modifier;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.servlet.ServletContainerInitializer;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.HandlesTypes;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.core.annotation.AnnotationAwareOrderComparator;
+
+/**
+ * Servlet 3.0 {@link ServletContainerInitializer} designed to support code-based
+ * configuration of the servlet container using Spring's {@link WebApplicationInitializer}
+ * SPI as opposed to (or possibly in combination with) the traditional
+ * {@code web.xml}-based approach.
+ *
+ * <h2>Mechanism of Operation</h2>
+ * This class will be loaded and instantiated and have its {@link #onStartup} method
+ * invoked by any Servlet 3.0-compliant container during container startup assuming that
+ * the {@code spring-web} module JAR is present on the classpath. This occurs through the
+ * JAR Services API {@link ServiceLoader#load(Class)} method detecting the
+ * {@code spring-web} module's {@code META-INF/services/javax.servlet.ServletContainerInitializer}
+ * service provider configuration file. See the
+ * <a href="http://download.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Service%20Provider">
+ * JAR Services API documentation</a> as well as section <em>8.2.4</em> of the Servlet 3.0
+ * Final Draft specification for complete details.
+ *
+ * <h3>when in combination with {@code web.xml}</h3>
+ * <p>If a web application does include a {@code WEB-INF/web.xml} file, it is important to
+ * understand that neither this nor any other {@code ServletContextInitializer} will be
+ * processed unless the {@code <web-app>} element's {@code version} attribute is >= "3.0"
+ * and the {@code xsi:schemaLocation} for "http://java.sun.com/xml/ns/javaee" is set to
+ * "http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd".
+ *
+ * <h2>Relationship to Spring's {@code WebApplicationInitializer}</h2>
+ * Spring's {@code WebApplicationInitializer} SPI consists of just one method:
+ * {@link WebApplicationInitializer#onStartup(ServletContext)}. The signature is intentionally
+ * quite similar to {@link ServletContainerInitializer#onStartup(Set, ServletContext)}:
+ * simply put, {@code SpringServletContainerInitializer} is responsible for instantiating
+ * and delegating the {@code ServletContext} to any user-defined
+ * {@code WebApplicationInitializer} implementations. It is then the responsibility of
+ * each {@code WebApplicationInitializer} to do the actual work of initializing the
+ * {@code ServletContext}. The exact process of delegation is described in detail in the
+ * {@link #onStartup} documentation below.
+ *
+ * <h2>General Notes</h2>
+ * In general, this class should be viewed as <em>supporting infrastructure</em> for
+ * the more important and user-facing {@code WebApplicationInitializer} SPI. Taking
+ * advantage of this container initializer is also completely <em>optional</em>: while
+ * it is true that this initializer will be loaded and invoked under all Servlet 3.0+
+ * runtimes, it remains the user's choice whether to make any
+ * {@code WebApplicationInitializer} implementations available on the classpath. If no
+ * {@code WebApplicationInitializer} types are detected, this container initializer will
+ * have no effect.
+ *
+ * <p>Note that use of this container initializer and of {@code WebApplicationInitializer}
+ * is not in any way "tied" to Spring MVC other than the fact that the types are shipped
+ * in the {@code spring-web} module JAR. Rather, they can be considered general-purpose
+ * in their ability to facilitate convenient code-based configuration of the
+ * {@code ServletContext}. Said another way, any servlet, listener, or filter may be
+ * registered within a {@code WebApplicationInitializer}, not just Spring MVC-specific
+ * components.
+ *
+ * <p>This class is not designed for nor intended to be extended. It should be considered
+ * an internal type, with {@code WebApplicationInitializer} being the public-facing SPI.
+ *
+ * <h2>See Also</h2>
+ * See {@link WebApplicationInitializer} Javadoc for examples and detailed usage
+ * recommendations.<p>
+ *
+ * @author Chris Beams
+ * @since 3.1
+ * @see #onStartup(Set, ServletContext)
+ * @see WebApplicationInitializer
+ */
+@HandlesTypes(WebApplicationInitializer.class)
+public class SpringServletContainerInitializer implements ServletContainerInitializer {
+
+ private static final Log logger = LogFactory.getLog(SpringServletContainerInitializer.class);
+
+ /**
+ * Delegate the {@code ServletContext} to any {@link WebApplicationInitializer}
+ * implementations present on the application classpath.
+ *
+ * <p>Because this class declares @{@code HandlesTypes(WebApplicationInitializer.class)},
+ * Servlet 3.0+ containers will automatically scan the classpath for implementations
+ * of Spring's {@code WebApplicationInitializer} interface and provide the set of all
+ * such types to the {@code webAppInitializerClasses} parameter of this method.
+ *
+ * <p>If no {@code WebApplicationInitializer} implementations are found on the
+ * classpath, this method is effectively a no-op. An INFO-level log message will be
+ * issued notifying the user that the {@code ServletContainerInitializer} has indeed
+ * been invoked, but that no {@code WebApplicationInitializer} implementations were
+ * found.
+ *
+ * <p>Assuming that one or more {@code WebApplicationInitializer} types are detected,
+ * they will be instantiated (and <em>sorted</em> if the @{@link
+ * org.springframework.core.annotation.Order Order} annotation is present or
+ * the {@link org.springframework.core.Ordered Ordered} interface has been
+ * implemented). Then the {@link WebApplicationInitializer#onStartup(ServletContext)}
+ * method will be invoked on each instance, delegating the {@code ServletContext} such
+ * that each instance may register and configure servlets such as Spring's
+ * {@code DispatcherServlet}, listeners such as Spring's {@code ContextLoaderListener}
+ * or any other Servlet API componentry such as filters.
+ *
+ * @param webAppInitializerClasses all implementations of
+ * {@link WebApplicationInitializer} found on the application classpath.
+ * @param servletContext the servlet context to be initialized
+ * @see WebApplicationInitializer#onStartup(ServletContext)
+ * @see AnnotationAwareOrderComparator
+ */
+ public void onStartup(Set<Class<?>> webAppInitializerClasses,
+ ServletContext servletContext) throws ServletException {
+
+ Set<WebApplicationInitializer> initializers =
+ new TreeSet<WebApplicationInitializer>(new AnnotationAwareOrderComparator());
+
+ for (Class<?> waiClass : webAppInitializerClasses) {
+ if (Modifier.isAbstract(waiClass.getModifiers())) {
+ // the class is not instantiable (i.e. abstract or an interface) -> skip it
+ continue;
+ }
+
+ initializers.add(instantiateClass(waiClass, WebApplicationInitializer.class));
+ }
+
+ if (initializers.isEmpty()) {
+ logger.info("Detected no WebApplicationInitializer types on the classpath: exiting.");
+ return;
+ }
+
+ logger.info("Delegating ServletContext to the following " +
+ "WebApplicationInitializer instances: " + initializers);
+
+ for (WebApplicationInitializer initializer : initializers) {
+ initializer.onStartup(servletContext);
+ }
+
+ }
+
+} | true |
Other | spring-projects | spring-framework | c9e67b2ef25ff1f5de32e4fc75a36f076fd14f35.json | Introduce Servlet 3.0 WebApplicationInitializer
WebApplicationInitializer provides a programmatic alternative to the
traditional WEB-INF/web.xml servlet container deployment descriptor
for Servlet API 3.0+ environments.
This is done by building atop the new ServletContainerInitializer
support in Servlet 3.0. See SpringServletContainerInitializer for
complete details. And see WebApplicationInitializer Javadoc for
typical usage examples.
Issue: SPR-7672 | org.springframework.web/src/main/java/org/springframework/web/WebApplicationInitializer.java | @@ -0,0 +1,183 @@
+/*
+ * Copyright 2002-2011 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.springframework.web;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * Interface to be implemented in Servlet 3.0+ environments in order to configure the
+ * {@link ServletContext} programmatically -- as opposed to (or possibly in conjunction
+ * with) the traditional {@code web.xml}-based approach.
+ *
+ * <p>Implementations of this SPI will be detected automatically by the
+ * {@link SpringServletContainerInitializer}, which itself is automatically bootstrapped
+ * by Servlet 3.0 container. See {@linkplain SpringServletContainerInitializer its Javadoc}
+ * for details on this bootstrapping mechanism.
+ *
+ * <h2>Example</h2>
+ * <h3>The traditional, XML-based approach</h3>
+ * Most Spring users building a web application will need to register Spring's {@code
+ * DispatcherServlet}. For reference, in WEB-INF/web.xml, this would typically be done as
+ * follows:
+ * <pre class="code">
+ * {@code
+ * <servlet>
+ * <servlet-name>dispatcher</servlet-name>
+ * <servlet-class>
+ * org.springframework.web.servlet.DispatcherServlet
+ * </servlet-class>
+ * <init-param>
+ * <param-name>contextConfigLocation</param-name>
+ * <param-value>/WEB-INF/spring/dispatcher-config.xml</param-value>
+ * </init-param>
+ * <load-on-startup>1</load-on-startup>
+ * </servlet>
+ *
+ * <servlet-mapping>
+ * <servlet-name>dispatcher</servlet-name>
+ * <url-pattern>/main</url-pattern>
+ * </servlet-mapping>}</pre>
+ *
+ * <h3>The code-based approach with {@code WebApplicationInitializer}</h3>
+ * Here is the equivalent {@code DispatcherServlet} registration logic,
+ * {@code WebApplicationInitializer}-style:
+ * <pre class="code">
+ * public class MyWebAppInitializer implements WebApplicationInitializer {
+ *
+ * @Override
+ * public void onStartup(ServletContext container) {
+ * XmlWebApplicationContext appContext = new XmlWebApplicationContext()
+ * appContext.setConfigLocation("/WEB-INF/spring/dispatcher-config.xml");
+ *
+ * ServletRegistration.Dynamic dispatcher =
+ * container.addServlet("dispatcher", new DispatcherServlet(appContext));
+ * dispatcher.setLoadOnStartup(1);
+ * dispatcher.addMapping("/main");
+ * }
+ *
+ * }</pre>
+ *
+ * As you can see, thanks to Servlet 3.0's new {@link ServletContext#addServlet} method
+ * we're actually registering an <em>instance</em> of the {@code DispatcherServlet}, and
+ * this means that the {@code DispatcherServlet} can now be treated like any other object
+ * -- receiving constructor injection of its application context in this case.
+ *
+ * <p>This style is both simpler and more concise. There is no concern for dealing with
+ * init-params, etc, just normal JavaBean-style properties and constructor arguments. You
+ * are free to create and work with your Spring application contexts as necessary before
+ * injecting them into the {@code DispatcherServlet}.
+ *
+ * <p>Most major Spring Web componentry has been updated to support this style of
+ * registration. You'll find that {@code DispatcherServlet}, {@code FrameworkServlet},
+ * {@code ContextLoaderListener} and {@code DelegatingFilterProxy} all now support
+ * constructor arguments. Even if a component (e.g. non-Spring, other third party) has not
+ * been specifically updated for use within {@code WebApplicationInitializers}, they still
+ * may be used in any case. The Servlet 3.0 {@code ServletContext} API allows for setting
+ * init-params, context-params, etc programmatically.
+ *
+ * <h2>A 100% code-based approach to configuration</h2>
+ * In the example above, {@code WEB-INF/web.xml} was successfully replaced with code in
+ * the form of a {@code WebApplicationInitializer}, but the actual
+ * {@code dispatcher-config.xml} Spring configuration remained XML-based.
+ * {@code WebApplicationInitializer} is a perfect fit for use with Spring's code-based
+ * {@code @Configuration} classes. See @{@link
+ * org.springframework.context.annotation.Configuration Configuration} Javadoc for
+ * complete details, but the following example demonstrates refactoring to use Spring's
+ * {@link org.springframework.web.context.support.AnnotationConfigWebApplicationContext
+ * AnnotationConfigWebApplicationContext} in lieu of {@code XmlWebApplicationContext}, and
+ * user-defined {@code @Configuration} classes {@code AppConfig} and
+ * {@code DispatcherConfig} instead of Spring XML files. This example also goes a bit
+ * beyond those above to demonstrate typical configuration of the 'root' application
+ * context and registration of the {@code ContextLoaderListener}:
+ * <pre class="code">
+ * public class MyWebAppInitializer implements WebApplicationInitializer {
+ *
+ * @Override
+ * public void onStartup(ServletContext container) {
+ * // Create the 'root' Spring application context
+ * AnnotationConfigWebApplicationContext rootContext =
+ * new AnnotationConfigWebApplicationContext();
+ * rootContext.register(AppConfig.class);
+ *
+ * // Manage the lifecycle of the root application context
+ * container.addListener(new ContextLoaderListener(rootContext));
+ *
+ * // Create the dispatcher servlet's Spring application context
+ * AnnotationConfigWebApplicationContext dispatcherContext =
+ * new AnnotationConfigWebApplicationContext();
+ * dispatcherContext.register(DispatcherConfig.class);
+ *
+ * // Register and map the dispatcher servlet
+ * ServletRegistration.Dynamic dispatcher =
+ * container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext));
+ * dispatcher.setLoadOnStartup(1);
+ * dispatcher.addMapping("/main");
+ * }
+ *
+ * }</pre>
+ *
+ * Remember that {@code WebApplicationInitializer} implementations are <em>detected
+ * automatically</em> -- so you are free to package them within your application as you
+ * see fit.
+ *
+ * <h2>Ordering {@code WebApplicationInitializer} execution</h2>
+ * {@code WebApplicationInitializer} implementations may optionally be annotated at the
+ * class level with Spring's @{@link org.springframework.core.annotation.Order Order}
+ * annotation or may implement Spring's {@link org.springframework.core.Ordered Ordered}
+ * interface. If so, the initializers will be ordered prior to invocation. This provides
+ * a mechanism for users to ensure the order in which servlet container initialization
+ * occurs. Use of this feature is expected to be rare, as typical applications will likely
+ * centralize all container initialization within a single {@code WebApplicationInitializer}.
+ *
+ * <h2>Caveats</h2>
+ *
+ * <h3>web.xml versioning</h3>
+ * <p>{@code WEB-INF/web.xml} and {@code WebApplicationInitializer} use are not mutually
+ * exclusive; for example, web.xml can register one servlet, and a {@code
+ * WebApplicationInitializer} can register another. An initializer can even
+ * <em>modify</em> registrations performed in {@code web.xml} through the
+ * {@link ServletContext#getServletRegistration(String)} method and its similiars.
+ * <strong>However, if {@code WEB-INF/web.xml} is present in the application, its
+ * {@code version} attribute must be set to "3.0" or greater, otherwise {@code
+ * ServletContainerInitializer} bootstrapping will be ignored by the servlet container.
+ * </strong>
+ *
+ * <h3>Mapping to '/' under Tomcat</h3>
+ * <p>Apache Tomcat maps its internal {@code DefaultServlet} to "/", and on Tomcat versions
+ * <= 7.0.14, this servlet mapping <em>cannot be overridden programmatically</em>. This
+ * is a <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=51278">known issue</a>
+ * and scheduled to be addressed in the next revision of Tomcat. Overriding the "/"
+ * servlet mapping has been tested successfully on GlassFish 3.1.<p>
+ *
+ * @author Chris Beams
+ * @since 3.1
+ * @see SpringServletContainerInitializer
+ */
+public interface WebApplicationInitializer {
+
+ /**
+ * Configure the given {@link ServletContext} with any servlets, filters, listeners
+ * context-params and attributes necessary for initializing this web application. See
+ * examples {@linkplain WebApplicationInitializer above}.
+ * @param servletContext the {@code ServletContext} to initialize
+ * @throws ServletException if any call against the given {@code ServletContext}
+ * throws a {@code ServletException}
+ */
+ void onStartup(ServletContext servletContext) throws ServletException;
+
+} | true |
Other | spring-projects | spring-framework | c9e67b2ef25ff1f5de32e4fc75a36f076fd14f35.json | Introduce Servlet 3.0 WebApplicationInitializer
WebApplicationInitializer provides a programmatic alternative to the
traditional WEB-INF/web.xml servlet container deployment descriptor
for Servlet API 3.0+ environments.
This is done by building atop the new ServletContainerInitializer
support in Servlet 3.0. See SpringServletContainerInitializer for
complete details. And see WebApplicationInitializer Javadoc for
typical usage examples.
Issue: SPR-7672 | org.springframework.web/src/main/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContext.java | @@ -37,14 +37,19 @@
* as for classpath scanning (specifying base packages as config location).
*
* <p>This is essentially the equivalent of
- * {@link org.springframework.context.annotation.AnnotationConfigApplicationContext}
- * for a web environment.
+ * {@link org.springframework.context.annotation.AnnotationConfigApplicationContext
+ * AnnotationConfigApplicationContext} for a web environment.
*
* <p>To make use of this application context, the
* {@linkplain ContextLoader#CONTEXT_CLASS_PARAM "contextClass"} context-param for
* ContextLoader and/or "contextClass" init-param for FrameworkServlet must be set to
* the fully-qualified name of this class.
*
+ * <p>As of Spring 3.1, this class may also be directly instantiated and injected into
+ * Spring's {@code DispatcherServlet} or {@code ContextLoaderListener} when using the
+ * new {@link org.springframework.web.WebApplicationInitializer WebApplicationInitializer}
+ * code-based alternative to {@code web.xml}. See its Javadoc for details and usage examples.
+ *
* <p>Unlike {@link XmlWebApplicationContext}, no default configuration class locations
* are assumed. Rather, it is a requirement to set the
* {@linkplain ContextLoader#CONFIG_LOCATION_PARAM "contextConfigLocation"} | true |
Other | spring-projects | spring-framework | c9e67b2ef25ff1f5de32e4fc75a36f076fd14f35.json | Introduce Servlet 3.0 WebApplicationInitializer
WebApplicationInitializer provides a programmatic alternative to the
traditional WEB-INF/web.xml servlet container deployment descriptor
for Servlet API 3.0+ environments.
This is done by building atop the new ServletContainerInitializer
support in Servlet 3.0. See SpringServletContainerInitializer for
complete details. And see WebApplicationInitializer Javadoc for
typical usage examples.
Issue: SPR-7672 | org.springframework.web/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer | @@ -0,0 +1 @@
+org.springframework.web.SpringServletContainerInitializer
\ No newline at end of file | true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/.classpath | @@ -15,7 +15,7 @@
<classpathentry kind="var" path="IVY_CACHE/javax.faces/com.springsource.javax.faces/1.2.0.08/com.springsource.javax.faces-1.2.0.08.jar" sourcepath="/IVY_CACHE/javax.faces/com.springsource.javax.faces/1.2.0.08/com.springsource.javax.faces-sources-1.2.0.08.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.portlet/com.springsource.javax.portlet/2.0.0/com.springsource.javax.portlet-2.0.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp/2.1.0/com.springsource.javax.servlet.jsp-2.1.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet.jsp/2.1.0/com.springsource.javax.servlet.jsp-sources-2.1.0.jar"/>
- <classpathentry kind="var" path="IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-2.5.0.jar" sourcepath="/IVY_CACHE/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-sources-2.5.0.jar"/>
+ <classpathentry kind="var" path="IVY_CACHE/javax.servlet/javax.servlet/3.0.0.v201103241009/javax.servlet-3.0.0.v201103241009.jar" sourcepath="IVY_CACHE/javax.servlet/javax.servlet/3.0.0.v201103241009/javax.servlet-sources-3.0.0.v201103241009.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.xml.rpc/com.springsource.javax.xml.rpc/1.1.0/com.springsource.javax.xml.rpc-1.1.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/javax.xml.soap/com.springsource.javax.xml.soap/1.3.0/com.springsource.javax.xml.soap-1.3.0.jar" sourcepath="/IVY_CACHE/javax.xml.soap/com.springsource.javax.xml.soap/1.3.0/com.springsource.javax.xml.soap-sources-1.3.0.jar"/>
<classpathentry kind="var" path="IVY_CACHE/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar" sourcepath="/IVY_CACHE/org.aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-sources-1.0.0.jar"/> | true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/ivy.xml | @@ -43,7 +43,7 @@
<dependency org="javax.faces" name="com.springsource.javax.faces" rev="1.2.0.08"
conf="provided, faces->compile"/>
<dependency org="javax.portlet" name="com.springsource.javax.portlet" rev="2.0.0" conf="provided->compile"/>
- <dependency org="javax.servlet" name="com.springsource.javax.servlet" rev="2.5.0" conf="provided->compile"/>
+ <dependency org="javax.servlet" name="javax.servlet" rev="3.0.0.v201103241009" conf="provided->compile"/>
<dependency org="javax.servlet" name="com.springsource.javax.servlet.jsp" rev="2.1.0"
conf="provided, jsp->compile"/>
<dependency org="javax.xml.rpc" name="com.springsource.javax.xml.rpc" rev="1.1.0" | true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/pom.xml | @@ -47,7 +47,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.5</version>
+ <version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency> | true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/src/test/java/org/springframework/mock/web/MockHttpServletRequest.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -18,6 +18,7 @@
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
@@ -34,19 +35,28 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.DispatcherType;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.Part;
import org.springframework.util.Assert;
import org.springframework.util.LinkedCaseInsensitiveMap;
/**
* Mock implementation of the {@link javax.servlet.http.HttpServletRequest}
- * interface. Supports the Servlet 2.5 API level.
+ * interface. Supports the Servlet 2.5 API level; throws
+ * {@link UnsupportedOperationException} for all methods introduced in Servlet 3.0.
*
* <p>Used for testing the web framework; also useful for testing
* application controllers.
@@ -55,6 +65,7 @@
* @author Rod Johnson
* @author Rick Evans
* @author Mark Fisher
+ * @author Chris Beams
* @since 1.0.2
*/
public class MockHttpServletRequest implements HttpServletRequest {
@@ -847,4 +858,53 @@ public boolean isRequestedSessionIdFromUrl() {
return isRequestedSessionIdFromURL();
}
+
+ //---------------------------------------------------------------------
+ // Methods introduced in Servlet 3.0
+ //---------------------------------------------------------------------
+
+ public AsyncContext getAsyncContext() {
+ throw new UnsupportedOperationException();
+ }
+
+ public DispatcherType getDispatcherType() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isAsyncSupported() {
+ throw new UnsupportedOperationException();
+ }
+
+ public AsyncContext startAsync() {
+ throw new UnsupportedOperationException();
+ }
+
+ public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isAsyncStarted() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Part getPart(String arg0) throws IOException, IllegalStateException, ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void login(String arg0, String arg1) throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void logout() throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
}
| true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/src/test/java/org/springframework/mock/web/MockHttpServletResponse.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -39,7 +39,7 @@
/**
* Mock implementation of the {@link javax.servlet.http.HttpServletResponse}
- * interface. Supports the Servlet 2.5 API level.
+ * interface. Supports the Servlet 3.0 API level
*
* <p>Used for testing the web framework; also useful for testing
* application controllers.
@@ -292,19 +292,19 @@ public Set<String> getHeaderNames() {
* @param name the name of the header
* @return the associated header value, or <code>null<code> if none
*/
- public Object getHeader(String name) {
+ public String getHeader(String name) {
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
- return (header != null ? header.getValue() : null);
+ return (header != null ? header.getValue().toString() : null);
}
/**
* Return all values for the given header as a List of value objects.
* @param name the name of the header
* @return the associated header values, or an empty List if none
*/
- public List<Object> getHeaders(String name) {
+ public List<String> getHeaders(String name) {
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
- return (header != null ? header.getValues() : Collections.emptyList());
+ return (header != null ? header.getStringValues() : Collections.<String>emptyList());
}
/**
| true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/src/test/java/org/springframework/mock/web/MockServletContext.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -23,16 +23,25 @@
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.EventListener;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import javax.activation.FileTypeMap;
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
+import javax.servlet.FilterRegistration.Dynamic;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.descriptor.JspConfigDescriptor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -67,8 +76,12 @@
* and XmlWebApplicationContext with an underlying MockServletContext (as long as
* the MockServletContext has been configured with a FileSystemResourceLoader).
*
+ * Supports the Servlet 3.0 API level, but throws {@link UnsupportedOperationException}
+ * for all methods introduced in Servlet 3.0.
+ *
* @author Rod Johnson
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 1.0.2
* @see #MockServletContext(org.springframework.core.io.ResourceLoader)
* @see org.springframework.web.context.support.XmlWebApplicationContext
@@ -361,4 +374,119 @@ public static String getMimeType(String filePath) {
}
}
+
+ //---------------------------------------------------------------------
+ // Methods introduced in Servlet 3.0
+ //---------------------------------------------------------------------
+
+ public Dynamic addFilter(String arg0, String arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Dynamic addFilter(String arg0, Filter arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Dynamic addFilter(String arg0, Class<? extends Filter> arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addListener(Class<? extends EventListener> arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addListener(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T extends EventListener> void addListener(T arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0, String arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ Servlet arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ Class<? extends Servlet> arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T extends Filter> T createFilter(Class<T> arg0)
+ throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T extends EventListener> T createListener(Class<T> arg0)
+ throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ public <T extends Servlet> T createServlet(Class<T> arg0)
+ throws ServletException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void declareRoles(String... arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ClassLoader getClassLoader() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getEffectiveMajorVersion() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getEffectiveMinorVersion() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ throw new UnsupportedOperationException();
+ }
+
+ public FilterRegistration getFilterRegistration(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+ throw new UnsupportedOperationException();
+ }
+
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServletRegistration getServletRegistration(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+ throw new UnsupportedOperationException();
+ }
+
+ public SessionCookieConfig getSessionCookieConfig() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean setInitParameter(String arg0, String arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setSessionTrackingModes(Set<SessionTrackingMode> arg0)
+ throws IllegalStateException, IllegalArgumentException {
+ throw new UnsupportedOperationException();
+ }
+
}
| true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/src/test/java/org/springframework/web/context/request/ServletWebRequestTests.java | @@ -136,7 +136,7 @@ public void checkModifiedTimeStamp() {
request.checkNotModified(currentTime);
assertEquals(200, servletResponse.getStatus());
- assertEquals(currentTime, servletResponse.getHeader("Last-Modified"));
+ assertEquals(""+currentTime, servletResponse.getHeader("Last-Modified"));
}
@Test | true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/template.mf | @@ -15,6 +15,7 @@ Import-Template:
javax.portlet.*;version="[2.0.0, 3.0.0)";resolution:=optional,
javax.servlet;version="[2.4.0, 4.0.0)",
javax.servlet.http;version="[2.4.0, 4.0.0)",
+ javax.servlet.annotation;version="[3.0.0, 4.0.0)";resolution:=optional,
javax.servlet.jsp.*;version="[2.0.0, 3.0.0)";resolution:=optional,
javax.xml.*;version="0";resolution:=optional,
org.aopalliance.*;version="[1.0.0, 2.0.0)", | true |
Other | spring-projects | spring-framework | 367a0c2933b610892f50875ca0f7f76228d8a9d0.json | Upgrade javax.servlet dependency to 3.0 for .web
In support of SPR-7672 which will support code-based configuration
alternatives to web.xml using new features in the Servlet 3.0 API.
This upgrade does *not* force Spring users to upgrade to Servlet 3.0
capable containers. Compatibility with and support for
javax.servlet >= 2.4 remains.
Issue: SPR-7672 | org.springframework.web/web.iml | @@ -47,11 +47,11 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$IVY_CACHE$/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-2.5.0.jar!/" />
+ <root url="jar://$IVY_CACHE$/javax.servlet/javax.servlet/3.0.0.v201103241009/javax.servlet-3.0.0.v201103241009.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
- <root url="jar://$IVY_CACHE$/javax.servlet/com.springsource.javax.servlet/2.5.0/com.springsource.javax.servlet-sources-2.5.0.jar!/" />
+ <root url="jar://$IVY_CACHE$/javax.servlet/javax.servlet/3.0.0.v201103241009/javax.servlet-sources-3.0.0.v201103241009.jar!/" />
</SOURCES>
</library>
</orderEntry> | true |
Other | spring-projects | spring-framework | 2ceeff370aff402bd669f9125d93e99d09e8ce71.json | Allow multiple locations via @PropertySource#value
Issue: SPR-8314 | org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java | @@ -174,12 +174,14 @@ protected void doProcessConfigurationClass(ConfigurationClass configClass, Annot
metadata.getAnnotationAttributes(org.springframework.context.annotation.PropertySource.class.getName());
if (propertySourceAttributes != null) {
String name = (String) propertySourceAttributes.get("name");
- String location = (String) propertySourceAttributes.get("value");
+ String[] locations = (String[]) propertySourceAttributes.get("value");
ClassLoader classLoader = this.resourceLoader.getClassLoader();
- ResourcePropertySource ps = StringUtils.hasText(name) ?
- new ResourcePropertySource(name, location, classLoader) :
- new ResourcePropertySource(location, classLoader);
- this.propertySources.push(ps);
+ for (String location : locations) {
+ ResourcePropertySource ps = StringUtils.hasText(name) ?
+ new ResourcePropertySource(name, location, classLoader) :
+ new ResourcePropertySource(location, classLoader);
+ this.propertySources.push(ps);
+ }
}
// process any @ComponentScan annotions | true |
Other | spring-projects | spring-framework | 2ceeff370aff402bd669f9125d93e99d09e8ce71.json | Allow multiple locations via @PropertySource#value
Issue: SPR-8314 | org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java | @@ -117,12 +117,14 @@
String name() default "";
/**
- * Indicate the resource location of the properties file to be loaded.
+ * Indicate the resource location(s) of the properties file to be loaded.
* For example, {@code "classpath:/com/myco/app.properties"} or
* {@code "file:/path/to/file"}. Note that resource location wildcards
- * are not permitted, and that a location must evaluate to exactly one
- * {@code .properties} resource.
+ * are not permitted, and that each location must evaluate to exactly one
+ * {@code .properties} resource. Each location will be added to the
+ * enclosing {@code Environment} as its own property source, and in the order
+ * declared.
*/
- String value();
+ String[] value();
} | true |
Other | spring-projects | spring-framework | 0756a6abfed06ed4590341c5c9b10b41ad633e25.json | Polish PropertySource and Environment Javadoc | org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java | @@ -98,7 +98,8 @@
* <h3>Using the {@code Environment} API</h3>
* Externalized values may be looked up by injecting the Spring
* {@link org.springframework.core.env.Environment Environment} into a
- * {@code @Configuration} class:
+ * {@code @Configuration} class using the {@code @Autowired} or the {@code @Inject}
+ * annotation:
* <pre class="code">
* @Configuration
* public class AppConfig { | true |
Other | spring-projects | spring-framework | 0756a6abfed06ed4590341c5c9b10b41ad633e25.json | Polish PropertySource and Environment Javadoc | org.springframework.context/src/main/java/org/springframework/context/annotation/PropertySource.java | @@ -49,10 +49,10 @@
* }
* }</pre>
*
- * Notice that the {@code Environment} object is @{@link Autowired} into the
- * configuration class and then used when populating the {@code TestBean}
- * object. Given the configuration above, a call to {@code testBean.getName()} will
- * return "myTestBean".
+ * Notice that the {@code Environment} object is @{@link
+ * org.springframework.beans.factory.annotation.Autowired Autowired} into the
+ * configuration class and then used when populating the {@code TestBean} object. Given
+ * the configuration above, a call to {@code testBean.getName()} will return "myTestBean".
*
* <h3>A note on property overriding with @PropertySource</h3>
* In cases where a given property key exists in more than one {@code .properties}
@@ -91,21 +91,24 @@
* if the {@code @Configuration} classes above were registered via component-scanning,
* the ordering is difficult to predict. In such cases - and if overriding is important -
* it is recommended that the user fall back to using the programmatic PropertySource API.
- * See {@link org.springframework.core.env.ConfigurableEnvironment ConfigurableEnvironment} and
- * {@link org.springframework.core.env.MutablePropertySources MutablePropertySources} Javadoc
- * for details.
-
+ * See {@link org.springframework.core.env.ConfigurableEnvironment ConfigurableEnvironment}
+ * and * {@link org.springframework.core.env.MutablePropertySources MutablePropertySources}
+ * Javadoc for details.
*
* @author Chris Beams
* @since 3.1
+ * @see Configuration
+ * @see org.springframework.core.env.PropertySource
+ * @see org.springframework.core.env.ConfigurableEnvironment#getPropertySources()
+ * @see org.springframework.core.env.MutablePropertySources
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface PropertySource {
/**
- * Indicate the name of this PropertySource. If omitted, a name
+ * Indicate the name of this property source. If omitted, a name
* will be generated based on the description of the underlying
* resource.
* @see org.springframework.core.env.PropertySource#getName() | true |
Other | spring-projects | spring-framework | 0756a6abfed06ed4590341c5c9b10b41ad633e25.json | Polish PropertySource and Environment Javadoc | org.springframework.core/src/main/java/org/springframework/core/env/PropertySource.java | @@ -24,26 +24,34 @@
* Abstract base class representing a source of key/value property pairs. The underlying
* {@linkplain #getSource() source object} may be of any type {@code T} that encapsulates
* properties. Examples include {@link java.util.Properties} objects, {@link java.util.Map}
- * objects, {@code ServletContext} and {@code ServletConfig} objects (for access to init parameters).
- * Explore the {@code PropertySource} type hierarchy to see provided implementations.
+ * objects, {@code ServletContext} and {@code ServletConfig} objects (for access to init
+ * parameters). Explore the {@code PropertySource} type hierarchy to see provided
+ * implementations.
*
- * <p>{@code PropertySource} objects are not typically used in isolation, but rather through a
- * {@link PropertySources} object, which aggregates property sources and in conjunction with
- * a {@link PropertyResolver} implementation that can perform precedence-based searches across
- * the set of {@code PropertySources}.
+ * <p>{@code PropertySource} objects are not typically used in isolation, but rather
+ * through a {@link PropertySources} object, which aggregates property sources and in
+ * conjunction with a {@link PropertyResolver} implementation that can perform
+ * precedence-based searches across the set of {@code PropertySources}.
*
- * <p>{@code PropertySource} identity is determined not based on the content of encapsulated
- * properties, but rather based on the {@link #getName() name} of the {@code PropertySource}
- * alone. This is useful for manipulating {@code PropertySource} objects when in collection
- * contexts. See operations in {@link MutablePropertySources} as well as the
- * {@link #named(String)} and {@link #toString()} methods for details.
+ * <p>{@code PropertySource} identity is determined not based on the content of
+ * encapsulated properties, but rather based on the {@link #getName() name} of the
+ * {@code PropertySource} alone. This is useful for manipulating {@code PropertySource}
+ * objects when in collection contexts. See operations in {@link MutablePropertySources}
+ * as well as the {@link #named(String)} and {@link #toString()} methods for details.
+ *
+ * <p>Note that when working with @{@link
+ * org.springframework.context.annotation.Configuration Configuration} classes that
+ * the @{@link org.springframework.context.annotation.PropertySource PropertySource}
+ * annotation provides a convenient and declarative way of adding property sources to the
+ * enclosing {@code Environment}.
*
* @author Chris Beams
* @since 3.1
* @see PropertySources
* @see PropertyResolver
* @see PropertySourcesPropertyResolver
* @see MutablePropertySources
+ * @see org.springframework.context.annotation.PropertySource
*/
public abstract class PropertySource<T> {
| true |
Other | spring-projects | spring-framework | 0756a6abfed06ed4590341c5c9b10b41ad633e25.json | Polish PropertySource and Environment Javadoc | org.springframework.core/src/main/java/org/springframework/core/env/StandardEnvironment.java | @@ -67,7 +67,7 @@
* {@link org.springframework.context.support.AbstractApplicationContext#refresh()
* refresh()} method is called. This ensures that all PropertySources are available during
* the container bootstrap process, including use by
- * {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
+ * {@linkplain org.springframework.context.support.PropertySourcesPlaceholderConfigurer
* property placeholder configurers}.
*
* @author Chris Beams
@@ -93,6 +93,7 @@ public class StandardEnvironment extends AbstractEnvironment {
* </ul>
* <p>Properties present in {@value #SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME} will
* take precedence over those in {@value #SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME}.
+ * @see AbstractEnvironment#customizePropertySources(MutablePropertySources)
* @see #getSystemProperties()
* @see #getSystemEnvironment()
*/ | true |
Other | spring-projects | spring-framework | 0756a6abfed06ed4590341c5c9b10b41ad633e25.json | Polish PropertySource and Environment Javadoc | org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/StandardPortletEnvironment.java | @@ -68,6 +68,7 @@ public class StandardPortletEnvironment extends StandardEnvironment {
* initialized} once the actual {@link PortletConfig}, {@link PortletContext}, and
* {@link ServletContext} objects are available.
* @see StandardEnvironment#customizePropertySources
+ * @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
* @see PortletConfigPropertySource
* @see PortletContextPropertySource
* @see AbstractRefreshablePortletApplicationContext#initPropertySources | true |
Other | spring-projects | spring-framework | 0756a6abfed06ed4590341c5c9b10b41ad633e25.json | Polish PropertySource and Environment Javadoc | org.springframework.web/src/main/java/org/springframework/web/context/support/StandardServletEnvironment.java | @@ -77,6 +77,7 @@ public class StandardServletEnvironment extends StandardEnvironment {
* servlet property sources, but higher than system properties and environment
* variables.
* @see StandardEnvironment#customizePropertySources
+ * @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
* @see ServletConfigPropertySource
* @see ServletContextPropertySource
* @see org.springframework.jndi.JndiPropertySource | true |
Other | spring-projects | spring-framework | e128ee2464b1d4bcc988999f4e05da5e8ecdf0ed.json | Introduce AnnotationConfigWAC #scan and #register
Primarily for use in conjunction with ApplicationContextInitializer,
these new #scan and #register methods mirror those in
AnnotationConfigApplicationContext. #setConfigLocation
and #setConfigLocations methods remain for compatibility with
ContextLoader-style initialization, but have been locally overridden
and documented clearly.
AnnotationConfigWebApplicationContext#loadBeanDefinitions Javadoc has
also been updated to explain the processing logic for each of these
potential inputs.
Issue: SPR-8320 | org.springframework.web/src/main/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContext.java | @@ -16,12 +16,14 @@
package org.springframework.web.context.support;
-import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.annotation.ScopeMetadataResolver;
+import org.springframework.util.Assert;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
/**
* {@link org.springframework.web.context.WebApplicationContext} implementation
@@ -57,14 +59,92 @@
*/
public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWebApplicationContext {
+ private Class<?>[] annotatedClasses;
+
+ private String[] basePackages;
+
+ /**
+ * {@inheritDoc}
+ * <p>This implementation accepts delimited values in the form of fully-qualified
+ * class names, (typically of {@code Configuration} classes) or fully-qualified
+ * packages to scan for annotated classes. During {@link #loadBeanDefinitions}, these
+ * locations will be processed in their given order, first attempting to load each
+ * value as a class. If class loading fails (i.e. a {@code ClassNotFoundException}
+ * occurs), the value is assumed to be a package and scanning is attempted.
+ * <p>Note that this method exists primarily for compatibility with Spring's
+ * {@link org.springframework.web.context.ContextLoader} and that if this application
+ * context is being configured through an
+ * {@link org.springframework.context.ApplicationContextInitializer}, use of the
+ * {@link #register} and {@link #scan} methods are preferred.
+ * @see #register(Class...)
+ * @see #scan(String...)
+ * @see #setConfigLocations(String[])
+ * @see #loadBeanDefinitions(DefaultListableBeanFactory)
+ */
+ @Override
+ public void setConfigLocation(String location) {
+ super.setConfigLocation(location);
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>This implementation accepts individual location values as fully-qualified class
+ * names (typically {@code @Configuration} classes) or fully-qualified packages to
+ * scan. During {@link #loadBeanDefinitions}, these locations will be processed in
+ * order, first attempting to load values as a class, and upon class loading failure
+ * the value is assumed to be a package to be scanned.
+ * <p>Note that this method exists primarily for compatibility with Spring's
+ * {@link org.springframework.web.context.ContextLoader} and that if this application
+ * context is being configured through an
+ * {@link org.springframework.context.ApplicationContextInitializer}, use of the
+ * {@link #register} and {@link #scan} methods are preferred.
+ * @see #scan(String...)
+ * @see #register(Class...)
+ * @see #setConfigLocation(String)
+ * @see #loadBeanDefinitions(DefaultListableBeanFactory)
+ */
+ @Override
+ public void setConfigLocations(String[] locations) {
+ super.setConfigLocations(locations);
+ }
+
+ /**
+ * Set the annotated classes (typically {@code @Configuration} classes)
+ * for this web application context.
+ * @see #loadBeanDefinitions(DefaultListableBeanFactory)
+ */
+ public void register(Class<?>... annotatedClasses) {
+ Assert.notEmpty(annotatedClasses, "At least one annotated class must be specified");
+ this.annotatedClasses = annotatedClasses;
+ }
+
+ /**
+ * Set the base packages to be scanned for annotated classes.
+ * @see #loadBeanDefinitions(DefaultListableBeanFactory)
+ */
+ public void scan(String... basePackages) {
+ Assert.notEmpty(basePackages, "At least one base package must be specified");
+ this.basePackages = basePackages;
+ }
+
/**
- * Register a {@link BeanDefinition} for each class specified by {@link #getConfigLocations()},
- * or scan each specified package for annotated classes. Enables the default set of
- * annotation configuration post processors, such that {@code @Autowired},
- * {@code @Required}, and associated annotations can be used.
- * <p>Configuration class bean definitions are registered with generated bean definition
- * names unless the {@code value} attribute is provided to the stereotype annotation.
- * @see #getConfigLocations()
+ * Register a {@link org.springframework.beans.factory.config.BeanDefinition} for
+ * any classes specified by {@link #register(Class...)} and scan any packages
+ * specified by {@link #scan(String...)}.
+ * <p>For any values specified by {@link #setConfigLocation(String)} or
+ * {@link #setConfigLocations(String[])}, attempt first to load each location as a
+ * class, registering a {@code BeanDefinition} if class loading is successful,
+ * and if class loading fails (i.e. a {@code ClassNotFoundException} is raised),
+ * assume the value is a package and attempt to scan it for annotated classes.
+ * <p>Enables the default set of annotation configuration post processors, such that
+ * {@code @Autowired}, {@code @Required}, and associated annotations can be used.
+ * <p>Configuration class bean definitions are registered with generated bean
+ * definition names unless the {@code value} attribute is provided to the stereotype
+ * annotation.
+ * @see #register(Class...)
+ * @see #scan(String...)
+ * @see #setConfigLocation()
+ * @see #setConfigLocations()
* @see AnnotatedBeanDefinitionReader
* @see ClassPathBeanDefinitionScanner
*/
@@ -87,6 +167,22 @@ protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
scanner.setScopeMetadataResolver(scopeMetadataResolver);
}
+ if (!ObjectUtils.isEmpty(this.annotatedClasses)) {
+ if (logger.isInfoEnabled()) {
+ logger.info("Registering annotated classes: [" +
+ StringUtils.arrayToCommaDelimitedString(this.annotatedClasses) + "]");
+ }
+ reader.register(this.annotatedClasses);
+ }
+
+ if (!ObjectUtils.isEmpty(this.basePackages)) {
+ if (logger.isInfoEnabled()) {
+ logger.info("Scanning base packages: [" +
+ StringUtils.arrayToCommaDelimitedString(this.basePackages) + "]");
+ }
+ scanner.scan(this.basePackages);
+ }
+
String[] configLocations = getConfigLocations();
if (configLocations != null) {
for (String configLocation : configLocations) { | true |
Other | spring-projects | spring-framework | e128ee2464b1d4bcc988999f4e05da5e8ecdf0ed.json | Introduce AnnotationConfigWAC #scan and #register
Primarily for use in conjunction with ApplicationContextInitializer,
these new #scan and #register methods mirror those in
AnnotationConfigApplicationContext. #setConfigLocation
and #setConfigLocations methods remain for compatibility with
ContextLoader-style initialization, but have been locally overridden
and documented clearly.
AnnotationConfigWebApplicationContext#loadBeanDefinitions Javadoc has
also been updated to explain the processing logic for each of these
potential inputs.
Issue: SPR-8320 | org.springframework.web/src/test/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContextTests.java | @@ -16,9 +16,9 @@
package org.springframework.web.context.support;
-import static org.junit.Assert.*;
-import org.junit.Test;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -28,8 +28,20 @@
public class AnnotationConfigWebApplicationContextTests {
@Test
- public void testSingleWellFormedConfigLocation() {
- AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
+ public void registerSingleClass() {
+ AnnotationConfigWebApplicationContext ctx =
+ new AnnotationConfigWebApplicationContext();
+ ctx.register(Config.class);
+ ctx.refresh();
+
+ TestBean bean = ctx.getBean(TestBean.class);
+ assertNotNull(bean);
+ }
+
+ @Test
+ public void configLocationWithSingleClass() {
+ AnnotationConfigWebApplicationContext ctx =
+ new AnnotationConfigWebApplicationContext();
ctx.setConfigLocation(Config.class.getName());
ctx.refresh();
@@ -41,7 +53,7 @@ public void testSingleWellFormedConfigLocation() {
@Configuration
static class Config {
@Bean
- public TestBean testBean() {
+ public TestBean myTestBean() {
return new TestBean();
}
} | true |
Other | spring-projects | spring-framework | 99f7142e3f78e73cf191fedb41926189dee69dc5.json | Add @Ignored repro test for SPR-7538 | org.springframework.integration-tests/src/test/java/org/springframework/expression/spel/support/BeanFactoryTypeConverter.java | @@ -0,0 +1,91 @@
+package org.springframework.expression.spel.support;
+import java.beans.PropertyEditor;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.SimpleTypeConverter;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.core.convert.support.ConversionServiceFactory;
+import org.springframework.expression.TypeConverter;
+
+/**
+ * Copied from Spring Integration for purposes of reproducing
+ * {@link Spr7538Tests}.
+ */
+class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware {
+
+ private SimpleTypeConverter delegate = new SimpleTypeConverter();
+
+ private static ConversionService defaultConversionService;
+
+ private ConversionService conversionService;
+
+ public BeanFactoryTypeConverter() {
+ synchronized (this) {
+ if (defaultConversionService == null) {
+ defaultConversionService = ConversionServiceFactory.createDefaultConversionService();
+ }
+ }
+ this.conversionService = defaultConversionService;
+ }
+
+ public BeanFactoryTypeConverter(ConversionService conversionService) {
+ this.conversionService = conversionService;
+ }
+
+ public void setConversionService(ConversionService conversionService) {
+ this.conversionService = conversionService;
+ }
+
+ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+ if (beanFactory instanceof ConfigurableBeanFactory) {
+ Object typeConverter = ((ConfigurableBeanFactory) beanFactory).getTypeConverter();
+ if (typeConverter instanceof SimpleTypeConverter) {
+ delegate = (SimpleTypeConverter) typeConverter;
+ }
+ }
+ }
+
+ public boolean canConvert(Class<?> sourceType, Class<?> targetType) {
+ if (conversionService.canConvert(sourceType, targetType)) {
+ return true;
+ }
+ if (!String.class.isAssignableFrom(sourceType) && !String.class.isAssignableFrom(targetType)) {
+ // PropertyEditor cannot convert non-Strings
+ return false;
+ }
+ if (!String.class.isAssignableFrom(sourceType)) {
+ return delegate.findCustomEditor(sourceType, null) != null || delegate.getDefaultEditor(sourceType) != null;
+ }
+ return delegate.findCustomEditor(targetType, null) != null || delegate.getDefaultEditor(targetType) != null;
+ }
+
+ public boolean canConvert(TypeDescriptor sourceTypeDescriptor, TypeDescriptor targetTypeDescriptor) {
+ if (conversionService.canConvert(sourceTypeDescriptor, targetTypeDescriptor)) {
+ return true;
+ }
+ // TODO: what does this mean? This method is not used in SpEL so probably ignorable?
+ Class<?> sourceType = sourceTypeDescriptor.getObjectType();
+ Class<?> targetType = targetTypeDescriptor.getObjectType();
+ return canConvert(sourceType, targetType);
+ }
+
+ public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) {
+ if (targetType.getType() == Void.class || targetType.getType() == Void.TYPE) {
+ return null;
+ }
+ if (conversionService.canConvert(sourceType, targetType)) {
+ return conversionService.convert(value, sourceType, targetType);
+ }
+ if (!String.class.isAssignableFrom(sourceType.getType())) {
+ PropertyEditor editor = delegate.findCustomEditor(sourceType.getType(), null);
+ editor.setValue(value);
+ return editor.getAsText();
+ }
+ return delegate.convertIfNecessary(value, targetType.getType());
+ }
+
+}
\ No newline at end of file | true |
Other | spring-projects | spring-framework | 99f7142e3f78e73cf191fedb41926189dee69dc5.json | Add @Ignored repro test for SPR-7538 | org.springframework.integration-tests/src/test/java/org/springframework/expression/spel/support/Spr7538Tests.java | @@ -0,0 +1,49 @@
+package org.springframework.expression.spel.support;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.core.MethodParameter;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.expression.MethodExecutor;
+
+public class Spr7538Tests {
+
+ @Ignore @Test
+ public void repro() throws Exception {
+ AlwaysTrueReleaseStrategy target = new AlwaysTrueReleaseStrategy();
+ BeanFactoryTypeConverter converter = new BeanFactoryTypeConverter();
+
+ StandardEvaluationContext context = new StandardEvaluationContext();
+ context.setTypeConverter(converter);
+
+ List<Foo> arguments = new ArrayList<Foo>();
+
+ // !!!! With the below line commented you'll get NPE. Uncomment and everything is OK!
+ //arguments.add(new Foo());
+
+ List<TypeDescriptor> paramDescriptors = new ArrayList<TypeDescriptor>();
+ Method method = AlwaysTrueReleaseStrategy.class.getMethod("checkCompleteness", List.class);
+ paramDescriptors.add(new TypeDescriptor(new MethodParameter(method, 0)));
+
+
+ List<TypeDescriptor> argumentTypes = new ArrayList<TypeDescriptor>();
+ argumentTypes.add(TypeDescriptor.forObject(arguments));
+ ReflectiveMethodResolver resolver = new ReflectiveMethodResolver();
+ MethodExecutor executor = resolver.resolve(context, target, "checkCompleteness", argumentTypes);
+
+ Object result = executor.execute(context, target, arguments);
+ System.out.println("Result: " + result);
+ }
+
+ public static class AlwaysTrueReleaseStrategy {
+ public boolean checkCompleteness(List<Foo> messages) {
+ return true;
+ }
+ }
+
+ public static class Foo{}
+}
\ No newline at end of file | true |
Other | spring-projects | spring-framework | a417aa2ea3f0e1bd9abd91bbc06c0fc750906259.json | ignore failing map test case | org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/mvc/annotation/Spr7839Tests.java | @@ -7,6 +7,7 @@
import java.util.Map;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.support.ConversionServiceFactory;
@@ -62,6 +63,28 @@ public void listElement() throws Exception {
}
@Test
+ public void listElementAutogrowObject() throws Exception {
+ request.setRequestURI("/nested/listElement");
+ request.addParameter("nested.list[0].foo", "Nested");
+ adapter.handle(request, response, controller);
+ }
+
+ @Test
+ public void listOfListsElement() throws Exception {
+ request.setRequestURI("/nested/listOfLists");
+ request.addParameter("nested.listOfLists[0][0]", "Nested");
+ adapter.handle(request, response, controller);
+ }
+
+ @Test
+ public void listOfListsElementAutogrowObject() throws Exception {
+ request.setRequestURI("/nested/listOfLists");
+ request.addParameter("nested.listOfLists[0][0].foo", "Nested");
+ adapter.handle(request, response, controller);
+ }
+
+ @Test
+ @Ignore
public void map() throws Exception {
request.setRequestURI("/nested/map");
request.addParameter("nested.map['apple'].foo", "bar");
@@ -90,6 +113,11 @@ public void handlerMap(JavaBean bean) {
public void handlerListElement(JavaBean bean) {
assertEquals("Nested", bean.nested.list.get(0).foo);
}
+
+ @RequestMapping("/nested/listOfLists")
+ public void handlerListOfLists(JavaBean bean) {
+ assertEquals("Nested", bean.nested.listOfLists.get(0).get(0).foo);
+ }
}
@@ -113,7 +141,9 @@ public static class NestedBean {
private String foo;
private List<NestedBean> list;
-
+
+ private List<List<NestedBean>> listOfLists;
+
private Map<String, NestedBean> map = new HashMap<String, NestedBean>();
public NestedBean() {
@@ -148,7 +178,13 @@ public void setMap(Map<String, NestedBean> map) {
this.map = map;
}
-
+ public List<List<NestedBean>> getListOfLists() {
+ return listOfLists;
+ }
+
+ public void setListOfLists(List<List<NestedBean>> listOfLists) {
+ this.listOfLists = listOfLists;
+ }
}
| false |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.beans/src/main/java/org/springframework/beans/factory/Aware.java | @@ -0,0 +1,39 @@
+/*
+ * Copyright 2002-2011 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.springframework.beans.factory;
+
+/**
+ * Marker superinterface indicating that a bean is eligible to be
+ * notified by the Spring container of a particular framework object
+ * through a callback-style method. Actual method signature is
+ * determined by individual subinterfaces, but should typically
+ * consist of just one void-returning method that accepts a single
+ * argument.
+ *
+ * <p>Note that merely implementing {@link Aware} provides no default
+ * functionality. Rather, processing must be done explicitly, for example
+ * in a {@link org.springframework.beans.factory.config.BeanPostProcessor BeanPostProcessor}.
+ * Refer to {@link org.springframework.context.support.ApplicationContextAwareProcessor}
+ * and {@link org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory}
+ * for examples of processing {@code *Aware} interface callbacks.
+ *
+ * @author Chris Beams
+ * @since 3.1
+ */
+public interface Aware {
+
+} | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanClassLoaderAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -29,12 +29,13 @@
* {@link BeanFactory BeanFactory javadocs}.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 2.0
* @see BeanNameAware
* @see BeanFactoryAware
* @see InitializingBean
*/
-public interface BeanClassLoaderAware {
+public interface BeanClassLoaderAware extends Aware {
/**
* Callback that supplies the bean {@link ClassLoader class loader} to | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanFactoryAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2010 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.
@@ -31,13 +31,14 @@
* {@link BeanFactory BeanFactory javadocs}.
*
* @author Rod Johnson
+ * @author Chris Beams
* @since 11.03.2003
* @see BeanNameAware
* @see BeanClassLoaderAware
* @see InitializingBean
* @see org.springframework.context.ApplicationContextAware
*/
-public interface BeanFactoryAware {
+public interface BeanFactoryAware extends Aware {
/**
* Callback that supplies the owning factory to a bean instance. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanNameAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -27,12 +27,13 @@
* {@link BeanFactory BeanFactory javadocs}.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 01.11.2003
* @see BeanClassLoaderAware
* @see BeanFactoryAware
* @see InitializingBean
*/
-public interface BeanNameAware {
+public interface BeanNameAware extends Aware {
/**
* Set the name of the bean in the bean factory that created this bean. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | @@ -48,6 +48,7 @@
import org.springframework.beans.PropertyValue;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.TypeConverter;
+import org.springframework.beans.factory.Aware;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanCurrentlyInCreationException;
@@ -1426,16 +1427,18 @@ public Object run() {
}
return wrappedBean;
}
-
+
private void invokeAwareMethods(final String beanName, final Object bean) {
- if (bean instanceof BeanNameAware) {
- ((BeanNameAware) bean).setBeanName(beanName);
- }
- if (bean instanceof BeanClassLoaderAware) {
- ((BeanClassLoaderAware) bean).setBeanClassLoader(getBeanClassLoader());
- }
- if (bean instanceof BeanFactoryAware) {
- ((BeanFactoryAware) bean).setBeanFactory(AbstractAutowireCapableBeanFactory.this);
+ if (bean instanceof Aware) {
+ if (bean instanceof BeanNameAware) {
+ ((BeanNameAware) bean).setBeanName(beanName);
+ }
+ if (bean instanceof BeanClassLoaderAware) {
+ ((BeanClassLoaderAware) bean).setBeanClassLoader(getBeanClassLoader());
+ }
+ if (bean instanceof BeanFactoryAware) {
+ ((BeanFactoryAware) bean).setBeanFactory(AbstractAutowireCapableBeanFactory.this);
+ }
}
}
| true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java | @@ -203,7 +203,6 @@ public void setAllowEagerClassLoading(boolean allowEagerClassLoading) {
*/
public void setAutowireCandidateResolver(final AutowireCandidateResolver autowireCandidateResolver) {
Assert.notNull(autowireCandidateResolver, "AutowireCandidateResolver must not be null");
- // TODO SPR-7515: should also do EnvironmentAware injection here?
if (autowireCandidateResolver instanceof BeanFactoryAware) {
if (System.getSecurityManager() != null) {
final BeanFactory target = this; | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context.support/src/main/java/org/springframework/scheduling/quartz/SchedulerContextAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -17,6 +17,7 @@
package org.springframework.scheduling.quartz;
import org.quartz.SchedulerContext;
+import org.springframework.beans.factory.Aware;
/**
* Callback interface to be implemented by Spring-managed
@@ -27,11 +28,12 @@
* that are passed in via Spring's SchedulerFactoryBean.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 2.0
* @see org.quartz.spi.JobFactory
* @see SchedulerFactoryBean#setJobFactory
*/
-public interface SchedulerContextAware {
+public interface SchedulerContextAware extends Aware {
/**
* Set the SchedulerContext of the current Quartz Scheduler. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/context/ApplicationContextAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -17,6 +17,7 @@
package org.springframework.context;
import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.Aware;
/**
* Interface to be implemented by any object that wishes to be notified
@@ -48,13 +49,14 @@
*
* @author Rod Johnson
* @author Juergen Hoeller
+ * @author Chris Beams
* @see ResourceLoaderAware
* @see ApplicationEventPublisherAware
* @see MessageSourceAware
* @see org.springframework.context.support.ApplicationObjectSupport
* @see org.springframework.beans.factory.BeanFactoryAware
*/
-public interface ApplicationContextAware {
+public interface ApplicationContextAware extends Aware {
/**
* Set the ApplicationContext that this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/context/ApplicationEventPublisherAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2005 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,16 +16,19 @@
package org.springframework.context;
+import org.springframework.beans.factory.Aware;
+
/**
* Interface to be implemented by any object that wishes to be notified
* of the ApplicationEventPublisher (typically the ApplicationContext)
* that it runs in.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 1.1.1
* @see ApplicationContextAware
*/
-public interface ApplicationEventPublisherAware {
+public interface ApplicationEventPublisherAware extends Aware {
/**
* Set the ApplicationEventPublisher that this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/context/EmbeddedValueResolverAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,6 +16,7 @@
package org.springframework.context;
+import org.springframework.beans.factory.Aware;
import org.springframework.util.StringValueResolver;
/**
@@ -26,10 +27,11 @@
* ApplicationContextAware/BeanFactoryAware interfaces.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 3.0.3
* @see org.springframework.beans.factory.config.ConfigurableBeanFactory#resolveEmbeddedValue
*/
-public interface EmbeddedValueResolverAware {
+public interface EmbeddedValueResolverAware extends Aware {
/**
* Set the StringValueResolver to use for resolving embedded definition values.
| true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/context/EnvironmentAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,6 +16,7 @@
package org.springframework.context;
+import org.springframework.beans.factory.Aware;
import org.springframework.core.env.Environment;
/**
@@ -25,7 +26,7 @@
* @author Chris Beams
* @since 3.1
*/
-public interface EnvironmentAware {
+public interface EnvironmentAware extends Aware {
/**
* Set the {@code Environment} that this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/context/MessageSourceAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2005 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,6 +16,8 @@
package org.springframework.context;
+import org.springframework.beans.factory.Aware;
+
/**
* Interface to be implemented by any object that wishes to be notified
* of the MessageSource (typically the ApplicationContext) that it runs in.
@@ -25,10 +27,11 @@
* it is defined as bean with name "messageSource" in the application context.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 1.1.1
* @see ApplicationContextAware
*/
-public interface MessageSourceAware {
+public interface MessageSourceAware extends Aware {
/**
* Set the MessageSource that this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/context/ResourceLoaderAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,6 +16,7 @@
package org.springframework.context;
+import org.springframework.beans.factory.Aware;
import org.springframework.core.io.ResourceLoader;
/**
@@ -47,6 +48,7 @@
* automatic type conversion by the bean factory.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 10.03.2004
* @see ApplicationContextAware
* @see org.springframework.beans.factory.InitializingBean
@@ -57,7 +59,7 @@
* @see org.springframework.core.io.support.PathMatchingResourcePatternResolver
* @see org.springframework.context.support.ReloadableResourceBundleMessageSource
*/
-public interface ResourceLoaderAware {
+public interface ResourceLoaderAware extends Aware {
/**
* Set the ResourceLoader that this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java | @@ -21,6 +21,7 @@
import java.security.PrivilegedAction;
import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.Aware;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.ApplicationContextAware;
@@ -97,24 +98,26 @@ public Object run() {
}
private void invokeAwareInterfaces(Object bean) {
- if (bean instanceof EmbeddedValueResolverAware) {
- ((EmbeddedValueResolverAware) bean).setEmbeddedValueResolver(
- new EmbeddedValueResolver(this.applicationContext.getBeanFactory()));
- }
- if (bean instanceof ResourceLoaderAware) {
- ((ResourceLoaderAware) bean).setResourceLoader(this.applicationContext);
- }
- if (bean instanceof ApplicationEventPublisherAware) {
- ((ApplicationEventPublisherAware) bean).setApplicationEventPublisher(this.applicationContext);
- }
- if (bean instanceof MessageSourceAware) {
- ((MessageSourceAware) bean).setMessageSource(this.applicationContext);
- }
- if (bean instanceof ApplicationContextAware) {
- ((ApplicationContextAware) bean).setApplicationContext(this.applicationContext);
- }
- if (bean instanceof EnvironmentAware) {
- ((EnvironmentAware) bean).setEnvironment(this.applicationContext.getEnvironment());
+ if (bean instanceof Aware) {
+ if (bean instanceof EmbeddedValueResolverAware) {
+ ((EmbeddedValueResolverAware) bean).setEmbeddedValueResolver(
+ new EmbeddedValueResolver(this.applicationContext.getBeanFactory()));
+ }
+ if (bean instanceof ResourceLoaderAware) {
+ ((ResourceLoaderAware) bean).setResourceLoader(this.applicationContext);
+ }
+ if (bean instanceof ApplicationEventPublisherAware) {
+ ((ApplicationEventPublisherAware) bean).setApplicationEventPublisher(this.applicationContext);
+ }
+ if (bean instanceof MessageSourceAware) {
+ ((MessageSourceAware) bean).setMessageSource(this.applicationContext);
+ }
+ if (bean instanceof ApplicationContextAware) {
+ ((ApplicationContextAware) bean).setApplicationContext(this.applicationContext);
+ }
+ if (bean instanceof EnvironmentAware) {
+ ((EnvironmentAware) bean).setEnvironment(this.applicationContext.getEnvironment());
+ }
}
}
| true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/context/weaving/LoadTimeWeaverAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,17 +16,19 @@
package org.springframework.context.weaving;
+import org.springframework.beans.factory.Aware;
import org.springframework.instrument.classloading.LoadTimeWeaver;
/**
* Interface to be implemented by any object that wishes to be notified
* of the application context's default {@link LoadTimeWeaver}.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 2.5
* @see org.springframework.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME
*/
-public interface LoadTimeWeaverAware {
+public interface LoadTimeWeaverAware extends Aware {
/**
* Set the {@link LoadTimeWeaver} of this object's containing | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.context/src/main/java/org/springframework/jmx/export/notification/NotificationPublisherAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -16,6 +16,8 @@
package org.springframework.jmx.export.notification;
+import org.springframework.beans.factory.Aware;
+
/**
* Interface to be implemented by any Spring-managed resource that is to be
* registered with an {@link javax.management.MBeanServer} and wishes to send
@@ -33,10 +35,11 @@
* interface (or implementing a full {@link javax.management.modelmbean.ModelMBean}).
*
* @author Rob Harrop
+ * @author Chris Beams
* @since 2.0
* @see NotificationPublisher
*/
-public interface NotificationPublisherAware {
+public interface NotificationPublisherAware extends Aware {
/**
* Set the {@link NotificationPublisher} instance for the current managed resource instance. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.transaction/src/main/java/org/springframework/jca/context/BootstrapContextAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -18,16 +18,19 @@
import javax.resource.spi.BootstrapContext;
+import org.springframework.beans.factory.Aware;
+
/**
* Interface to be implemented by any object that wishes to be
* notified of the BootstrapContext (typically determined by the
* {@link ResourceAdapterApplicationContext}) that it runs in.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 2.5
* @see javax.resource.spi.BootstrapContext
*/
-public interface BootstrapContextAware {
+public interface BootstrapContextAware extends Aware {
/**
* Set the BootstrapContext that this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2005 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -18,16 +18,19 @@
import javax.portlet.PortletConfig;
+import org.springframework.beans.factory.Aware;
+
/**
* Interface to be implemented by any object that wishes to be notified
* of the PortletConfig (typically determined by the PortletApplicationContext)
* that it runs in.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 2.0
* @see PortletContextAware
*/
-public interface PortletConfigAware {
+public interface PortletConfigAware extends Aware {
/**
* Set the PortletConfigthat this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2005 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -18,17 +18,20 @@
import javax.portlet.PortletContext;
+import org.springframework.beans.factory.Aware;
+
/**
* Interface to be implemented by any object that wishes to be notified
* of the PortletContext (typically determined by the PortletApplicationContext)
* that it runs in.
*
* @author Juergen Hoeller
* @author William G. Thompson, Jr.
+ * @author Chris Beams
* @since 2.0
* @see PortletConfigAware
*/
-public interface PortletContextAware {
+public interface PortletContextAware extends Aware {
/**
* Set the PortletContext that this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.web/src/main/java/org/springframework/web/context/ServletConfigAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -18,6 +18,8 @@
import javax.servlet.ServletConfig;
+import org.springframework.beans.factory.Aware;
+
/**
* Interface to be implemented by any object that wishes to be notified
* of the ServletConfig (typically determined by the WebApplicationContext)
@@ -28,10 +30,11 @@
* elsewhere, an exception will be thrown on bean creation.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 2.0
* @see ServletContextAware
*/
-public interface ServletConfigAware {
+public interface ServletConfigAware extends Aware {
/**
* Set the ServletConfig that this object runs in. | true |
Other | spring-projects | spring-framework | 5e6912302af99d78d05aff7080ed9b8bb33df913.json | Introduce "Aware" superinterface
All existing *Aware interfaces have been refactored to extend this
new marker interface, serving two purposes:
* Easy access to a type hierarchy that can answer the question
"What *Aware interfaces are available?", without requiring
text-based searches. Also clearly excludes false positives like
TargetClassAware and ParamAware, which while similarly named,
are not semantically similar to traditional *Aware interfaces
in Spring.
* Minor potential performance improvements in
AbstractAutowireCapableBeanFactory and
ApplicationContextAwareProcessor. Both have blocks of sequential
instanceof checks in order to invoke any *Aware interface callback
methods. For a bean that implements none of these interfaces,
the whole sequence can be avoided by guarding first with
if (bean instanceof Aware) {
...
}
Implementors of custom *Aware-style interfaces (and presumably
the BeanPostProcessors that handle them), are encouraged to refactor to
extending this interface for consistency with the framework as well as
the points above. | org.springframework.web/src/main/java/org/springframework/web/context/ServletContextAware.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2005 the original author or authors.
+ * Copyright 2002-2011 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.
@@ -18,16 +18,19 @@
import javax.servlet.ServletContext;
+import org.springframework.beans.factory.Aware;
+
/**
* Interface to be implemented by any object that wishes to be notified
* of the ServletContext (typically determined by the WebApplicationContext)
* that it runs in.
*
* @author Juergen Hoeller
+ * @author Chris Beams
* @since 12.03.2004
* @see ServletConfigAware
*/
-public interface ServletContextAware {
+public interface ServletContextAware extends Aware {
/**
* Set the ServletContext that this object runs in. | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.aop/src/test/java/org/springframework/aop/interceptor/DebugInterceptorTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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, | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.aop/src/test/java/org/springframework/aop/interceptor/SimpleTraceInterceptorTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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, | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.aop/src/test/java/org/springframework/aop/support/DelegatingIntroductionInterceptorTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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, | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/aop/config/AopNamespaceHandlerProxyTargetClassTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/aop/framework/adapter/AdvisorAdapterRegistrationTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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, | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/CustomEditorConfigurerTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/DateRange.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/ExceptionOnInitBean.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/PropertyPlaceholderConfigurerTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/annotation/AnnotationMetadataAssemblerTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/AbstractAutodetectTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/AbstractJmxAssemblerTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerAutodetectTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/ICustomBase.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/ICustomJmxBean.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssemblerMappedTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/MethodNameBasedMBeanInfoAssemblerTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/assembler/ReflectiveAssemblerTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/naming/AbstractNamingStrategyTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/naming/KeyNamingStrategyTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/naming/PropertiesFileNamingStrategyTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Other | spring-projects | spring-framework | 9f5fd3afcf7196dcae1ba5813f78561f9ee0f0a1.json | Normalize indentation of Apache license URL
In accordance with recommendations at
http://www.apache.org/licenses/LICENSE-2.0.html.
A number of classes had strayed from this format, now all
are the same. | org.springframework.context/src/test/java/org/springframework/jmx/export/naming/PropertiesNamingStrategyTests.java | @@ -5,7 +5,7 @@
* 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
+ * 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 | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.