diff --git a/SPR-16033/README.md b/SPR-16033/README.md new file mode 100644 index 00000000..4f46e0ed --- /dev/null +++ b/SPR-16033/README.md @@ -0,0 +1,37 @@ +# Repro project for SPR-16033 + +## 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-16033/pom.xml b/SPR-16033/pom.xml new file mode 100644 index 00000000..19c09cdb --- /dev/null +++ b/SPR-16033/pom.xml @@ -0,0 +1,84 @@ + + 4.0.0 + org.springframework.issues + SPR-16033 + 1.0-SNAPSHOT + jar + + + UTF-8 + + 1.8 + 5.0.1.RELEASE + 1.7.22 + + + + + org.springframework + spring-context + ${spring.version} + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + runtime + + + + 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-16033/src/main/java/org/springframework/issues/ConfigClass.java b/SPR-16033/src/main/java/org/springframework/issues/ConfigClass.java new file mode 100644 index 00000000..45c39914 --- /dev/null +++ b/SPR-16033/src/main/java/org/springframework/issues/ConfigClass.java @@ -0,0 +1,27 @@ +package org.springframework.issues; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ConfigClass { + @Bean + public IDummy bean1() { + return new Dummy(); + } + + @Bean + public IDummy bean2() { + return new Dummy(); + } + + @Bean + public IDummy bean3() { + return new Dummy(); + } + + @Bean + public IDummy bean4() { + return null; + } +} diff --git a/SPR-16033/src/main/java/org/springframework/issues/Dummy.java b/SPR-16033/src/main/java/org/springframework/issues/Dummy.java new file mode 100644 index 00000000..760f5f0c --- /dev/null +++ b/SPR-16033/src/main/java/org/springframework/issues/Dummy.java @@ -0,0 +1,5 @@ +package org.springframework.issues; + +public class Dummy implements IDummy { + +} diff --git a/SPR-16033/src/main/java/org/springframework/issues/IDummy.java b/SPR-16033/src/main/java/org/springframework/issues/IDummy.java new file mode 100644 index 00000000..80ccb345 --- /dev/null +++ b/SPR-16033/src/main/java/org/springframework/issues/IDummy.java @@ -0,0 +1,5 @@ +package org.springframework.issues; + +public interface IDummy { + +} diff --git a/SPR-16033/src/main/resources/.gitignore b/SPR-16033/src/main/resources/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/SPR-16033/src/test/java/org/springframework/issues/ReproTests.java b/SPR-16033/src/test/java/org/springframework/issues/ReproTests.java new file mode 100644 index 00000000..716208c2 --- /dev/null +++ b/SPR-16033/src/test/java/org/springframework/issues/ReproTests.java @@ -0,0 +1,28 @@ +package org.springframework.issues; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.Map; + +import org.junit.Test; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class ReproTests { + + @Test + public void repro() { + try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext()) { + ctx.register(ConfigClass.class); + ctx.refresh(); + Map beans = ctx.getBeansOfType(IDummy.class); + assertNotNull(beans.get("bean1")); + assertNotNull(beans.get("bean2")); + assertNotNull(beans.get("bean3")); + assertNull(beans.get("bean4")); + + } + + } + +} diff --git a/SPR-16033/src/test/resources/log4j.properties b/SPR-16033/src/test/resources/log4j.properties new file mode 100644 index 00000000..82776b7b --- /dev/null +++ b/SPR-16033/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-16033/src/test/resources/org/springframework/issues/ctx.xml b/SPR-16033/src/test/resources/org/springframework/issues/ctx.xml new file mode 100644 index 00000000..b1a6109d --- /dev/null +++ b/SPR-16033/src/test/resources/org/springframework/issues/ctx.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file