Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test for SPR-9637

  • Loading branch information...
commit b14a66eb6576fa8654bd35846a7e4e78183d19cb 1 parent e851990
@philwebb philwebb authored
View
69 SPR-9637/pom.xml
@@ -0,0 +1,69 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.springframework.issues</groupId>
+ <artifactId>SPR-9637</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>3.2.0.BUILD-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>spring-maven-snapshot</id>
+ <name>Springframework Maven Snapshot Repository</name>
+ <url>http://repo.springsource.org/snapshot</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <properties>
+ <project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7.2</version>
+ <configuration>
+ <includes>
+ <include>**/*Tests.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
View
32 SPR-9637/src/main/java/org/springframework/issues/ExampleBean.java
@@ -0,0 +1,32 @@
+package org.springframework.issues;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ExampleBean {
+
+ @Value("#{exampleSource.date}")
+ @DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
+ private Date injectedField;
+
+ private Date injectedMethod;
+
+ public Date getInjectedDate() {
+ return injectedField;
+ }
+
+
+ public Date getInjectedMethod() {
+ return injectedMethod;
+ }
+
+ @Value("#{exampleSource.date}")
+ @DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
+ public void setInjectedMethod(Date injectedMethod) {
+ this.injectedMethod = injectedMethod;
+ }
+}
View
12 SPR-9637/src/main/java/org/springframework/issues/ExampleSource.java
@@ -0,0 +1,12 @@
+package org.springframework.issues;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class ExampleSource {
+
+ public String getDate() {
+ return "2000-10-31";
+ }
+
+}
View
0  SPR-9637/src/main/resources/.gitignore
No changes.
View
26 SPR-9637/src/test/java/org/springframework/issues/ReproTests.java
@@ -0,0 +1,26 @@
+package org.springframework.issues;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Date;
+
+import org.junit.Test;
+import org.springframework.context.support.GenericXmlApplicationContext;
+
+/**
+ * Unit test that reproduces an issue reported against SPR JIRA. @Test methods within
+ * need not pass with the green bar! Rather they should fail in such a way that
+ * demonstrates the reported issue.
+ */
+public class ReproTests {
+
+ @Test
+ public void repro() {
+ GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
+ ctx.load("classpath:org/springframework/issues/ReproTests-context.xml");
+ ctx.refresh();
+ assertNotNull(ctx.getBean(ExampleBean.class).getInjectedDate());
+ }
+
+}
View
7 SPR-9637/src/test/resources/log4j.properties
@@ -0,0 +1,7 @@
+log4j.rootCategory=ERROR, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
+
+log4j.category.org.springframework=WARN
View
14 SPR-9637/src/test/resources/org/springframework/issues/ReproTests-context.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+
+ <context:component-scan base-package="org.springframework.issues"/>
+
+ <bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />
+
+</beans>
Please sign in to comment.
Something went wrong with that request. Please try again.