diff --git a/SPR-14971/README.md b/SPR-14971/README.md new file mode 100644 index 00000000..6b9cb370 --- /dev/null +++ b/SPR-14971/README.md @@ -0,0 +1,37 @@ +# Repro project for SPR-14971 + +## Deploying + +It is possible to deploy your application directly from the command-line +using maven. You can use either [cargo](http://cargo.codehaus.org/) or +the [jetty plugin](http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html) +to run on a wide range of containers. + +### Cargo + +By default Cargo is configured to start `Tomcat7` and can be invoked by +running `mvn package cargo:run`. Cargo can also run a [wide range of other +containers](http://cargo.codehaus.org/Containers) and you can easily add +yours by editing the `pom.xml`. For instance, a `tomcat8` profile +has been added and can be invoked via `mvn package cargo:run -Ptomcat8`. + +You can remote debug the application, in your IDE, by using the following command: + `mvn package cargo:run -Ptomcat8 -Pdebug`. Note that you can customize the debug + port used with the `cargo.jvm.debug.port` maven property. + +### Jetty + +To deploy your application to jetty9, simply invoke `mvn jetty:run`. It +is possible to tune the exact jetty9 version you want to use by specifying +the version of the command line, e.g. `mvn jetty:run -Djetty.version=9.0.6.v20130930` + +To run a different version of jetty, please fallback to cargo as the +coordinates of the maven plugin have changed. A sample `jetty8` profile is +created for reference and can be tuned to suit your needs. To deploy your +sample application to jetty8 run `mvn cargo:run -Pjetty8` + +## Logging + +This project contains a `log4j.properties` file in `src/main/resources` that you +may wish to configure to emit more detailed logging. The root logger is set to +`INFO` and a custom `org.springframework.web` logger is set to `DEBUG`. diff --git a/SPR-14971/pom.xml b/SPR-14971/pom.xml new file mode 100644 index 00000000..d73cae1f --- /dev/null +++ b/SPR-14971/pom.xml @@ -0,0 +1,96 @@ + + 4.0.0 + org.springframework.issues + SPR-14971 + 1.0-SNAPSHOT + jar + + + UTF-8 + + 1.6 + 4.3.4.RELEASE + 1.7.21 + + + + + org.springframework + spring-context + ${spring.version} + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + runtime + + + + org.projectlombok + lombok + 1.16.10 + + + + org.springframework + spring-test + ${spring.version} + test + + + junit + junit + 4.12 + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + ${java.version} + ${java.version} + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12.4 + + + **/*Tests.java + **/*Test.java + + + **/*Abstract*.java + + + + + + + + + spring-maven-snapshot + Springframework Maven Snapshot Repository + http://repo.spring.io/snapshot + + true + + + + + + diff --git a/SPR-14971/src/test/java/org/springframework/issues/ReproTests.java b/SPR-14971/src/test/java/org/springframework/issues/ReproTests.java new file mode 100644 index 00000000..b6da6369 --- /dev/null +++ b/SPR-14971/src/test/java/org/springframework/issues/ReproTests.java @@ -0,0 +1,49 @@ +package org.springframework.issues; + +import java.util.Arrays; +import java.util.Collection; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.support.ConversionServiceFactoryBean; +import org.springframework.core.convert.ConversionService; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@DirtiesContext +@ContextConfiguration( classes = { ReproTests.Configuration.class }) +public class ReproTests { + @Autowired + ConversionService service; + + @Test + public void testConversionService() { + Collection source = Arrays.asList(new Person("Name", 30)); + + if (service.canConvert(source.getClass(), String.class)) { + service.convert(source, String.class); + } + } + + @Data + @AllArgsConstructor + @NoArgsConstructor + public static class Person { + private String name; + private int age; + } + + public static class Configuration { + @Bean + ConversionServiceFactoryBean defaultConversionServiceFactoryBean() { + return new ConversionServiceFactoryBean(); + } + } +} diff --git a/SPR-14971/src/test/resources/log4j.properties b/SPR-14971/src/test/resources/log4j.properties new file mode 100644 index 00000000..82776b7b --- /dev/null +++ b/SPR-14971/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 \ No newline at end of file diff --git a/SPR-14971/src/test/resources/org/springframework/issues/ReproTests-context.xml b/SPR-14971/src/test/resources/org/springframework/issues/ReproTests-context.xml new file mode 100644 index 00000000..6ba8b462 --- /dev/null +++ b/SPR-14971/src/test/resources/org/springframework/issues/ReproTests-context.xml @@ -0,0 +1,14 @@ + + + + + + + + + +