Permalink
Browse files

Reproduce SPR-9243

 - Simplify @Configuration usage
 - Upgrade to 3.2.0.BUILD-SNAPSHOT and demonstrate failure
  • Loading branch information...
1 parent 7a10945 commit 88f748a47d059b08225dff09af356b4d4021d97c @cbeams cbeams committed May 1, 2012
Showing with 10 additions and 50 deletions.
  1. +5 −16 SPR-9243/pom.xml
  2. +1 −3 SPR-9243/src/main/java/org/chare/Config.java
  3. +4 −31 SPR-9243/src/test/java/org/chare/ConfigTest.java
View
@@ -11,7 +11,7 @@
<!-- FIXME change to this version to pass the test
<org.springframework-version>3.1.0.RELEASE</org.springframework-version>
-->
- <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
+ <org.springframework-version>3.2.0.BUILD-SNAPSHOT</org.springframework-version>
<org.slf4j-version>1.5.10</org.slf4j-version>
</properties>
<dependencies>
@@ -25,7 +25,7 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>org.springframework.web</artifactId>
+ <artifactId>spring-web</artifactId>
<version>${org.springframework-version}</version>
</dependency>
@@ -65,21 +65,10 @@
<repositories>
<repository>
- <id>spring.maven.milestone</id>
- <name>Spring Milestone Maven Repo</name>
- <url>http://repository.springsource.com/maven/bundles/milestone</url>
+ <id>repo.springsource.org</id>
+ <name>SpringSource Repository</name>
+ <url>http://repo.springsource.org/libs-snapshot</url>
</repository>
- <repository>
- <id>spring.maven.release</id>
- <name>Spring Release Maven Repo</name>
- <url>http://repository.springsource.com/maven/bundles/release</url>
- </repository>
- <repository>
- <id>com.springsource.repository.bundles.external</id>
- <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
- <url>http://repository.springsource.com/maven/bundles/external</url>
- </repository>
-
</repositories>
<build>
<plugins>
@@ -9,9 +9,7 @@
@Import({
org.chare.service.Config.class,
org.chare.otherService.Config.class
-}
- )
-
+})
public class Config {
}
@@ -1,46 +1,19 @@
package org.chare;
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
import org.chare.service.Service;
import org.junit.Test;
-import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
+
+import static org.junit.Assert.*;
public class ConfigTest {
@Test
public void testConfig() throws Exception {
- AbstractApplicationContext context = createContext(Config.class, DependencyConfig.class);
+ AbstractApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
assertNotNull(context.getBean(Service.class));
context.close();
}
- @Configuration
- static class DependencyConfig {
-
- }
-
-
- public static AnnotationConfigWebApplicationContext createContext(final Class<?> ... configClasses) {
- AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext() {
- @Override
- public String[] getConfigLocations() {
- return convertToConfigLocations(configClasses);
- }
- };
- context.refresh();
- return context;
- }
-
- public static String[] convertToConfigLocations(Class<?>... configClasses) {
- List<String> names = new ArrayList<String>();
- for (Class<?> configClass : configClasses)
- names.add(configClass.getName());
- return names.toArray(new String [] {});
- }
}

0 comments on commit 88f748a

Please sign in to comment.