|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
|
* Copyright 2002-2016 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. |
|
|
|
|
@ -20,15 +20,12 @@ import java.util.Collections;
@@ -20,15 +20,12 @@ import java.util.Collections;
|
|
|
|
|
|
|
|
|
|
import org.aspectj.lang.annotation.Aspect; |
|
|
|
|
import org.aspectj.lang.annotation.Before; |
|
|
|
|
|
|
|
|
|
import org.junit.Ignore; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
import org.springframework.aop.support.AopUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader; |
|
|
|
|
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; |
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
|
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
|
@ -59,26 +56,6 @@ public class ImportResourceTests {
@@ -59,26 +56,6 @@ public class ImportResourceTests {
|
|
|
|
|
ctx.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Ignore // TODO: SPR-6310
|
|
|
|
|
@Test |
|
|
|
|
public void importXmlWithRelativePath() { |
|
|
|
|
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportXmlWithRelativePathConfig.class); |
|
|
|
|
assertTrue("did not contain java-declared bean", ctx.containsBean("javaDeclaredBean")); |
|
|
|
|
assertTrue("did not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean")); |
|
|
|
|
TestBean tb = ctx.getBean("javaDeclaredBean", TestBean.class); |
|
|
|
|
assertEquals("myName", tb.getName()); |
|
|
|
|
ctx.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Ignore // TODO: SPR-6310
|
|
|
|
|
@Test |
|
|
|
|
public void importXmlByConvention() { |
|
|
|
|
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext( |
|
|
|
|
ImportXmlByConventionConfig.class); |
|
|
|
|
assertTrue("context does not contain xml-declared bean", ctx.containsBean("xmlDeclaredBean")); |
|
|
|
|
ctx.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void importXmlIsInheritedFromSuperclassDeclarations() { |
|
|
|
|
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(FirstLevelSubConfig.class); |
|
|
|
|
@ -112,15 +89,6 @@ public class ImportResourceTests {
@@ -112,15 +89,6 @@ public class ImportResourceTests {
|
|
|
|
|
ctx.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Ignore // TODO: SPR-6327
|
|
|
|
|
@Test |
|
|
|
|
public void importDifferentResourceTypes() { |
|
|
|
|
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SubResourceConfig.class); |
|
|
|
|
assertTrue(ctx.containsBean("propertiesDeclaredBean")); |
|
|
|
|
assertTrue(ctx.containsBean("xmlDeclaredBean")); |
|
|
|
|
ctx.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void importWithPlaceholder() throws Exception { |
|
|
|
|
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); |
|
|
|
|
@ -159,19 +127,6 @@ public class ImportResourceTests {
@@ -159,19 +127,6 @@ public class ImportResourceTests {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
@ImportResource("ImportXmlConfig-context.xml") |
|
|
|
|
static class ImportXmlWithRelativePathConfig { |
|
|
|
|
public @Bean TestBean javaDeclaredBean() { |
|
|
|
|
return new TestBean("java.declared"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
//@ImportXml
|
|
|
|
|
static class ImportXmlByConventionConfig { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
@ImportResource("classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml") |
|
|
|
|
static class BaseConfig { |
|
|
|
|
@ -217,9 +172,4 @@ public class ImportResourceTests {
@@ -217,9 +172,4 @@ public class ImportResourceTests {
|
|
|
|
|
static class ImportNonXmlResourceConfig { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
|
@ImportResource(locations = "classpath:org/springframework/context/annotation/configuration/ImportXmlConfig-context.xml", reader = XmlBeanDefinitionReader.class) |
|
|
|
|
static class SubResourceConfig extends ImportNonXmlResourceConfig { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|