Use Gradle test fixture support for spring-beans and spring-context
See gh-23550
This commit is contained in:
@@ -43,6 +43,11 @@ import org.springframework.beans.propertyeditors.CustomNumberEditor;
|
||||
import org.springframework.beans.propertyeditors.StringArrayPropertyEditor;
|
||||
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
||||
import org.springframework.beans.support.DerivedFromProtectedBaseBean;
|
||||
import org.springframework.beans.test.fixtures.beans.BooleanTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.NumberTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.convert.ConversionFailedException;
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
@@ -50,11 +55,6 @@ import org.springframework.core.convert.support.GenericConversionService;
|
||||
import org.springframework.core.test.fixtures.Assume;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.sample.beans.BooleanTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
import org.springframework.tests.sample.beans.NumberTestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
import org.springframework.beans.test.fixtures.beans.DerivedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceEditor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.sample.beans.DerivedTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.test.fixtures.beans.CustomEnum;
|
||||
import org.springframework.beans.test.fixtures.beans.GenericBean;
|
||||
import org.springframework.core.convert.support.DefaultConversionService;
|
||||
import org.springframework.tests.sample.beans.CustomEnum;
|
||||
import org.springframework.tests.sample.beans.GenericBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.propertyeditors.CustomNumberEditor;
|
||||
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
||||
import org.springframework.beans.test.fixtures.beans.GenericBean;
|
||||
import org.springframework.beans.test.fixtures.beans.GenericIntegerBean;
|
||||
import org.springframework.beans.test.fixtures.beans.GenericSetOfIntegerBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.tests.sample.beans.GenericBean;
|
||||
import org.springframework.tests.sample.beans.GenericIntegerBean;
|
||||
import org.springframework.tests.sample.beans.GenericSetOfIntegerBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Optional;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.ArrayList;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.OverridingClassLoader;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CachedIntrospectionResultsTests {
|
||||
assertThat(CachedIntrospectionResults.strongClassCache.containsKey(TestBean.class)).isTrue();
|
||||
|
||||
ClassLoader child = new OverridingClassLoader(getClass().getClassLoader());
|
||||
Class<?> tbClass = child.loadClass("org.springframework.tests.sample.beans.TestBean");
|
||||
Class<?> tbClass = child.loadClass("org.springframework.beans.test.fixtures.beans.TestBean");
|
||||
assertThat(CachedIntrospectionResults.strongClassCache.containsKey(tbClass)).isFalse();
|
||||
CachedIntrospectionResults.acceptClassLoader(child);
|
||||
bw = new BeanWrapperImpl(tbClass);
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.beans;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.math.BigDecimal;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.StaticListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.beans.test.fixtures.beans.AnnotatedBean;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestAnnotation;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.factory.DummyFactory;
|
||||
import org.springframework.cglib.proxy.NoOp;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.tests.sample.beans.AnnotatedBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
import org.springframework.tests.sample.beans.TestAnnotation;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.tests.sample.beans.factory.DummyFactory;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -78,6 +78,14 @@ import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.ConstructorDependenciesBean;
|
||||
import org.springframework.beans.propertyeditors.CustomNumberEditor;
|
||||
import org.springframework.beans.test.fixtures.beans.DependenciesBean;
|
||||
import org.springframework.beans.test.fixtures.beans.DerivedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.LifecycleBean;
|
||||
import org.springframework.beans.test.fixtures.beans.NestedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.SideEffectBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.factory.DummyFactory;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
@@ -91,14 +99,6 @@ import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.core.test.fixtures.TestGroup;
|
||||
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.tests.sample.beans.DependenciesBean;
|
||||
import org.springframework.tests.sample.beans.DerivedTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.LifecycleBean;
|
||||
import org.springframework.tests.sample.beans.NestedTestBean;
|
||||
import org.springframework.tests.sample.beans.SideEffectBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.tests.sample.beans.factory.DummyFactory;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.util.StringValueResolver;
|
||||
|
||||
|
||||
@@ -64,15 +64,15 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.NestedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
import org.springframework.tests.sample.beans.NestedTestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -40,11 +40,11 @@ import org.springframework.beans.factory.support.AutowireCandidateQualifier;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.NestedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.test.fixtures.io.SerializationTestUtils;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
import org.springframework.tests.sample.beans.NestedTestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.beans.PropertyEditorRegistry;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource;
|
||||
@@ -115,7 +115,7 @@ public class FieldRetrievingFactoryBeanTests {
|
||||
@Test
|
||||
public void testWithConstantOnClassWithPackageLevelVisibility() throws Exception {
|
||||
FieldRetrievingFactoryBean fr = new FieldRetrievingFactoryBean();
|
||||
fr.setBeanName("org.springframework.tests.sample.beans.PackageLevelVisibleBean.CONSTANT");
|
||||
fr.setBeanName("org.springframework.beans.test.fixtures.beans.PackageLevelVisibleBean.CONSTANT");
|
||||
fr.afterPropertiesSet();
|
||||
assertThat(fr.getObject()).isEqualTo("Wuby");
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource;
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition;
|
||||
|
||||
@@ -39,9 +39,9 @@ import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.support.ManagedMap;
|
||||
import org.springframework.beans.factory.support.ManagedSet;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource;
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.core.test.fixtures.io.ResourceTestUtils.qualifiedResource;
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Arrays;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.beans.factory.support;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.config.TypedStringValue;
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.beans.propertyeditors.CustomNumberEditor;
|
||||
import org.springframework.beans.test.fixtures.beans.GenericBean;
|
||||
import org.springframework.beans.test.fixtures.beans.GenericIntegerBean;
|
||||
import org.springframework.beans.test.fixtures.beans.GenericSetOfIntegerBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.OverridingClassLoader;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
@@ -50,10 +54,6 @@ import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.core.test.fixtures.EnabledForTestGroups;
|
||||
import org.springframework.tests.sample.beans.GenericBean;
|
||||
import org.springframework.tests.sample.beans.GenericIntegerBean;
|
||||
import org.springframework.tests.sample.beans.GenericSetOfIntegerBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.tests.sample.beans.DerivedTestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.DerivedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.beans.factory.support;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
||||
@@ -1,295 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.TypeMismatchException;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanIsNotAFactoryException;
|
||||
import org.springframework.beans.factory.BeanNotOfRequiredTypeException;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.tests.sample.beans.LifecycleBean;
|
||||
import org.springframework.tests.sample.beans.MustBeInitialized;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.tests.sample.beans.factory.DummyFactory;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Subclasses must initialize the bean factory and any other variables they need.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
public abstract class AbstractBeanFactoryTests {
|
||||
|
||||
protected abstract BeanFactory getBeanFactory();
|
||||
|
||||
/**
|
||||
* Roderick bean inherits from rod, overriding name only.
|
||||
*/
|
||||
@Test
|
||||
public void inheritance() {
|
||||
assertThat(getBeanFactory().containsBean("rod")).isTrue();
|
||||
assertThat(getBeanFactory().containsBean("roderick")).isTrue();
|
||||
TestBean rod = (TestBean) getBeanFactory().getBean("rod");
|
||||
TestBean roderick = (TestBean) getBeanFactory().getBean("roderick");
|
||||
assertThat(rod != roderick).as("not == ").isTrue();
|
||||
assertThat(rod.getName().equals("Rod")).as("rod.name is Rod").isTrue();
|
||||
assertThat(rod.getAge() == 31).as("rod.age is 31").isTrue();
|
||||
assertThat(roderick.getName().equals("Roderick")).as("roderick.name is Roderick").isTrue();
|
||||
assertThat(roderick.getAge() == rod.getAge()).as("roderick.age was inherited").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getBeanWithNullArg() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
getBeanFactory().getBean((String) null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that InitializingBean objects receive the afterPropertiesSet() callback
|
||||
*/
|
||||
@Test
|
||||
public void initializingBeanCallback() {
|
||||
MustBeInitialized mbi = (MustBeInitialized) getBeanFactory().getBean("mustBeInitialized");
|
||||
// The dummy business method will throw an exception if the
|
||||
// afterPropertiesSet() callback wasn't invoked
|
||||
mbi.businessMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that InitializingBean/BeanFactoryAware/DisposableBean objects receive the
|
||||
* afterPropertiesSet() callback before BeanFactoryAware callbacks
|
||||
*/
|
||||
@Test
|
||||
public void lifecycleCallbacks() {
|
||||
LifecycleBean lb = (LifecycleBean) getBeanFactory().getBean("lifecycle");
|
||||
assertThat(lb.getBeanName()).isEqualTo("lifecycle");
|
||||
// The dummy business method will throw an exception if the
|
||||
// necessary callbacks weren't invoked in the right order.
|
||||
lb.businessMethod();
|
||||
boolean condition = !lb.isDestroyed();
|
||||
assertThat(condition).as("Not destroyed").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findsValidInstance() {
|
||||
Object o = getBeanFactory().getBean("rod");
|
||||
boolean condition = o instanceof TestBean;
|
||||
assertThat(condition).as("Rod bean is a TestBean").isTrue();
|
||||
TestBean rod = (TestBean) o;
|
||||
assertThat(rod.getName().equals("Rod")).as("rod.name is Rod").isTrue();
|
||||
assertThat(rod.getAge() == 31).as("rod.age is 31").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInstanceByMatchingClass() {
|
||||
Object o = getBeanFactory().getBean("rod", TestBean.class);
|
||||
boolean condition = o instanceof TestBean;
|
||||
assertThat(condition).as("Rod bean is a TestBean").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInstanceByNonmatchingClass() {
|
||||
assertThatExceptionOfType(BeanNotOfRequiredTypeException.class).isThrownBy(() ->
|
||||
getBeanFactory().getBean("rod", BeanFactory.class))
|
||||
.satisfies(ex -> {
|
||||
assertThat(ex.getBeanName()).isEqualTo("rod");
|
||||
assertThat(ex.getRequiredType()).isEqualTo(BeanFactory.class);
|
||||
assertThat(ex.getActualType()).isEqualTo(TestBean.class).isEqualTo(getBeanFactory().getBean("rod").getClass());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSharedInstanceByMatchingClass() {
|
||||
Object o = getBeanFactory().getBean("rod", TestBean.class);
|
||||
boolean condition = o instanceof TestBean;
|
||||
assertThat(condition).as("Rod bean is a TestBean").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSharedInstanceByMatchingClassNoCatch() {
|
||||
Object o = getBeanFactory().getBean("rod", TestBean.class);
|
||||
boolean condition = o instanceof TestBean;
|
||||
assertThat(condition).as("Rod bean is a TestBean").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSharedInstanceByNonmatchingClass() {
|
||||
assertThatExceptionOfType(BeanNotOfRequiredTypeException.class).isThrownBy(() ->
|
||||
getBeanFactory().getBean("rod", BeanFactory.class))
|
||||
.satisfies(ex -> {
|
||||
assertThat(ex.getBeanName()).isEqualTo("rod");
|
||||
assertThat(ex.getRequiredType()).isEqualTo(BeanFactory.class);
|
||||
assertThat(ex.getActualType()).isEqualTo(TestBean.class);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sharedInstancesAreEqual() {
|
||||
Object o = getBeanFactory().getBean("rod");
|
||||
boolean condition1 = o instanceof TestBean;
|
||||
assertThat(condition1).as("Rod bean1 is a TestBean").isTrue();
|
||||
Object o1 = getBeanFactory().getBean("rod");
|
||||
boolean condition = o1 instanceof TestBean;
|
||||
assertThat(condition).as("Rod bean2 is a TestBean").isTrue();
|
||||
assertThat(o == o1).as("Object equals applies").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void prototypeInstancesAreIndependent() {
|
||||
TestBean tb1 = (TestBean) getBeanFactory().getBean("kathy");
|
||||
TestBean tb2 = (TestBean) getBeanFactory().getBean("kathy");
|
||||
assertThat(tb1 != tb2).as("ref equal DOES NOT apply").isTrue();
|
||||
assertThat(tb1.equals(tb2)).as("object equal true").isTrue();
|
||||
tb1.setAge(1);
|
||||
tb2.setAge(2);
|
||||
assertThat(tb1.getAge() == 1).as("1 age independent = 1").isTrue();
|
||||
assertThat(tb2.getAge() == 2).as("2 age independent = 2").isTrue();
|
||||
boolean condition = !tb1.equals(tb2);
|
||||
assertThat(condition).as("object equal now false").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notThere() {
|
||||
assertThat(getBeanFactory().containsBean("Mr Squiggle")).isFalse();
|
||||
assertThatExceptionOfType(BeansException.class).isThrownBy(() ->
|
||||
getBeanFactory().getBean("Mr Squiggle"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validEmpty() {
|
||||
Object o = getBeanFactory().getBean("validEmpty");
|
||||
boolean condition = o instanceof TestBean;
|
||||
assertThat(condition).as("validEmpty bean is a TestBean").isTrue();
|
||||
TestBean ve = (TestBean) o;
|
||||
assertThat(ve.getName() == null && ve.getAge() == 0 && ve.getSpouse() == null).as("Valid empty has defaults").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void typeMismatch() {
|
||||
assertThatExceptionOfType(BeanCreationException.class)
|
||||
.isThrownBy(() -> getBeanFactory().getBean("typeMismatch"))
|
||||
.withCauseInstanceOf(TypeMismatchException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void grandparentDefinitionFoundInBeanFactory() throws Exception {
|
||||
TestBean dad = (TestBean) getBeanFactory().getBean("father");
|
||||
assertThat(dad.getName().equals("Albert")).as("Dad has correct name").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void factorySingleton() throws Exception {
|
||||
assertThat(getBeanFactory().isSingleton("&singletonFactory")).isTrue();
|
||||
assertThat(getBeanFactory().isSingleton("singletonFactory")).isTrue();
|
||||
TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory");
|
||||
assertThat(tb.getName().equals(DummyFactory.SINGLETON_NAME)).as("Singleton from factory has correct name, not " + tb.getName()).isTrue();
|
||||
DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory");
|
||||
TestBean tb2 = (TestBean) getBeanFactory().getBean("singletonFactory");
|
||||
assertThat(tb == tb2).as("Singleton references ==").isTrue();
|
||||
assertThat(factory.getBeanFactory() != null).as("FactoryBean is BeanFactoryAware").isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void factoryPrototype() throws Exception {
|
||||
assertThat(getBeanFactory().isSingleton("&prototypeFactory")).isTrue();
|
||||
assertThat(getBeanFactory().isSingleton("prototypeFactory")).isFalse();
|
||||
TestBean tb = (TestBean) getBeanFactory().getBean("prototypeFactory");
|
||||
boolean condition = !tb.getName().equals(DummyFactory.SINGLETON_NAME);
|
||||
assertThat(condition).isTrue();
|
||||
TestBean tb2 = (TestBean) getBeanFactory().getBean("prototypeFactory");
|
||||
assertThat(tb != tb2).as("Prototype references !=").isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that we can get the factory bean itself.
|
||||
* This is only possible if we're dealing with a factory
|
||||
*/
|
||||
@Test
|
||||
public void getFactoryItself() throws Exception {
|
||||
assertThat(getBeanFactory().getBean("&singletonFactory")).isNotNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that afterPropertiesSet gets called on factory
|
||||
*/
|
||||
@Test
|
||||
public void factoryIsInitialized() throws Exception {
|
||||
TestBean tb = (TestBean) getBeanFactory().getBean("singletonFactory");
|
||||
assertThat(tb).isNotNull();
|
||||
DummyFactory factory = (DummyFactory) getBeanFactory().getBean("&singletonFactory");
|
||||
assertThat(factory.wasInitialized()).as("Factory was initialized because it implemented InitializingBean").isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* It should be illegal to dereference a normal bean as a factory.
|
||||
*/
|
||||
@Test
|
||||
public void rejectsFactoryGetOnNormalBean() {
|
||||
assertThatExceptionOfType(BeanIsNotAFactoryException.class).isThrownBy(() ->
|
||||
getBeanFactory().getBean("&rod"));
|
||||
}
|
||||
|
||||
// TODO: refactor in AbstractBeanFactory (tests for AbstractBeanFactory)
|
||||
// and rename this class
|
||||
@Test
|
||||
public void aliasing() {
|
||||
BeanFactory bf = getBeanFactory();
|
||||
if (!(bf instanceof ConfigurableBeanFactory)) {
|
||||
return;
|
||||
}
|
||||
ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) bf;
|
||||
|
||||
String alias = "rods alias";
|
||||
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
|
||||
cbf.getBean(alias))
|
||||
.satisfies(ex -> assertThat(ex.getBeanName()).isEqualTo(alias));
|
||||
|
||||
// Create alias
|
||||
cbf.registerAlias("rod", alias);
|
||||
Object rod = getBeanFactory().getBean("rod");
|
||||
Object aliasRod = getBeanFactory().getBean(alias);
|
||||
assertThat(rod == aliasRod).isTrue();
|
||||
}
|
||||
|
||||
|
||||
public static class TestBeanEditor extends PropertyEditorSupport {
|
||||
|
||||
@Override
|
||||
public void setAsText(String text) {
|
||||
TestBean tb = new TestBean();
|
||||
StringTokenizer st = new StringTokenizer(text, "_");
|
||||
tb.setName(st.nextToken());
|
||||
tb.setAge(Integer.parseInt(st.nextToken()));
|
||||
setValue(tb);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public abstract class AbstractListableBeanFactoryTests extends AbstractBeanFactoryTests {
|
||||
|
||||
/** Subclasses must initialize this */
|
||||
protected ListableBeanFactory getListableBeanFactory() {
|
||||
BeanFactory bf = getBeanFactory();
|
||||
if (!(bf instanceof ListableBeanFactory)) {
|
||||
throw new IllegalStateException("ListableBeanFactory required");
|
||||
}
|
||||
return (ListableBeanFactory) bf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses can override this.
|
||||
*/
|
||||
@Test
|
||||
public void count() {
|
||||
assertCount(13);
|
||||
}
|
||||
|
||||
protected final void assertCount(int count) {
|
||||
String[] defnames = getListableBeanFactory().getBeanDefinitionNames();
|
||||
assertThat(defnames.length == count).as("We should have " + count + " beans, not " + defnames.length).isTrue();
|
||||
}
|
||||
|
||||
protected void assertTestBeanCount(int count) {
|
||||
String[] defNames = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, false);
|
||||
assertThat(defNames.length == count).as("We should have " + count + " beans for class org.springframework.tests.sample.beans.TestBean, not " +
|
||||
defNames.length).isTrue();
|
||||
|
||||
int countIncludingFactoryBeans = count + 2;
|
||||
String[] names = getListableBeanFactory().getBeanNamesForType(TestBean.class, true, true);
|
||||
assertThat(names.length == countIncludingFactoryBeans).as("We should have " + countIncludingFactoryBeans +
|
||||
" beans for class org.springframework.tests.sample.beans.TestBean, not " + names.length).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDefinitionsForNoSuchClass() {
|
||||
String[] defnames = getListableBeanFactory().getBeanNamesForType(String.class);
|
||||
assertThat(defnames.length == 0).as("No string definitions").isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that count refers to factory class, not bean class. (We don't know
|
||||
* what type factories may return, and it may even change over time.)
|
||||
*/
|
||||
@Test
|
||||
public void getCountForFactoryClass() {
|
||||
assertThat(getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2).as("Should have 2 factories, not " +
|
||||
getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length).isTrue();
|
||||
|
||||
assertThat(getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length == 2).as("Should have 2 factories, not " +
|
||||
getListableBeanFactory().getBeanNamesForType(FactoryBean.class).length).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void containsBeanDefinition() {
|
||||
assertThat(getListableBeanFactory().containsBeanDefinition("rod")).isTrue();
|
||||
assertThat(getListableBeanFactory().containsBeanDefinition("roderick")).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,8 +22,8 @@ import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReader;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.Map;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.beans.factory.xml;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
/**
|
||||
* Simple bean used to check constructor dependency checking.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.tests.sample.beans.factory.DummyFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.factory.DummyFactory;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.beans.factory.xml;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -30,8 +30,8 @@ import org.springframework.beans.factory.parsing.ComponentDefinition;
|
||||
import org.springframework.beans.factory.parsing.ImportDefinition;
|
||||
import org.springframework.beans.factory.parsing.PassThroughSourceExtractor;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.CollectingReaderEventListener;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.beans.CollectingReaderEventListener;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.beans.factory.xml;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
/**
|
||||
* Test class for Spring's ability to create objects using static
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
/**
|
||||
* Test class for Spring's ability to create objects using
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ import org.xml.sax.SAXParseException;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.DummyBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.DummyBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.beans.factory.xml;
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
/**
|
||||
* Test class for Spring's ability to create
|
||||
|
||||
@@ -32,10 +32,10 @@ import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
import org.springframework.beans.factory.parsing.ComponentDefinition;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.CollectingReaderEventListener;
|
||||
import org.springframework.beans.test.fixtures.beans.CustomEnum;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.beans.CollectingReaderEventListener;
|
||||
import org.springframework.tests.sample.beans.CustomEnum;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -38,9 +38,9 @@ import org.springframework.beans.factory.config.ListFactoryBean;
|
||||
import org.springframework.beans.factory.config.MapFactoryBean;
|
||||
import org.springframework.beans.factory.config.SetFactoryBean;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.test.fixtures.beans.HasMap;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.HasMap;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
@@ -25,10 +25,10 @@ import org.springframework.beans.factory.BeanDefinitionStoreException;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.SimpleBeanDefinitionRegistry;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -30,11 +30,12 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.LifecycleBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.factory.DummyFactory;
|
||||
import org.springframework.beans.test.fixtures.factory.xml.AbstractListableBeanFactoryTests;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.LifecycleBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.tests.sample.beans.factory.DummyFactory;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@ import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.PropertyValue;
|
||||
import org.springframework.tests.sample.beans.BooleanTestBean;
|
||||
import org.springframework.tests.sample.beans.ITestBean;
|
||||
import org.springframework.tests.sample.beans.IndexedTestBean;
|
||||
import org.springframework.tests.sample.beans.NumberTestBean;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.BooleanTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.ITestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.IndexedTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.NumberTestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
@@ -593,9 +593,9 @@ public class CustomEditorTests {
|
||||
@Test
|
||||
public void testClassEditorWithArray() {
|
||||
PropertyEditor classEditor = new ClassEditor();
|
||||
classEditor.setAsText("org.springframework.tests.sample.beans.TestBean[]");
|
||||
classEditor.setAsText("org.springframework.beans.test.fixtures.beans.TestBean[]");
|
||||
assertThat(classEditor.getValue()).isEqualTo(TestBean[].class);
|
||||
assertThat(classEditor.getAsText()).isEqualTo("org.springframework.tests.sample.beans.TestBean[]");
|
||||
assertThat(classEditor.getAsText()).isEqualTo("org.springframework.beans.test.fixtures.beans.TestBean[]");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.parsing.AliasDefinition;
|
||||
import org.springframework.beans.factory.parsing.ComponentDefinition;
|
||||
import org.springframework.beans.factory.parsing.DefaultsDefinition;
|
||||
import org.springframework.beans.factory.parsing.ImportDefinition;
|
||||
import org.springframework.beans.factory.parsing.ReaderEventListener;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class CollectingReaderEventListener implements ReaderEventListener {
|
||||
|
||||
private final List<DefaultsDefinition> defaults = new LinkedList<>();
|
||||
|
||||
private final Map<String, ComponentDefinition> componentDefinitions = new LinkedHashMap<>(8);
|
||||
|
||||
private final Map<String, List<AliasDefinition>> aliasMap = new LinkedHashMap<>(8);
|
||||
|
||||
private final List<ImportDefinition> imports = new LinkedList<>();
|
||||
|
||||
|
||||
@Override
|
||||
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
||||
this.defaults.add(defaultsDefinition);
|
||||
}
|
||||
|
||||
public List<DefaultsDefinition> getDefaults() {
|
||||
return Collections.unmodifiableList(this.defaults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentRegistered(ComponentDefinition componentDefinition) {
|
||||
this.componentDefinitions.put(componentDefinition.getName(), componentDefinition);
|
||||
}
|
||||
|
||||
public ComponentDefinition getComponentDefinition(String name) {
|
||||
return this.componentDefinitions.get(name);
|
||||
}
|
||||
|
||||
public ComponentDefinition[] getComponentDefinitions() {
|
||||
Collection<ComponentDefinition> collection = this.componentDefinitions.values();
|
||||
return collection.toArray(new ComponentDefinition[collection.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
||||
List<AliasDefinition> aliases = this.aliasMap.get(aliasDefinition.getBeanName());
|
||||
if (aliases == null) {
|
||||
aliases = new ArrayList<>();
|
||||
this.aliasMap.put(aliasDefinition.getBeanName(), aliases);
|
||||
}
|
||||
aliases.add(aliasDefinition);
|
||||
}
|
||||
|
||||
public List<AliasDefinition> getAliases(String beanName) {
|
||||
List<AliasDefinition> aliases = this.aliasMap.get(beanName);
|
||||
return (aliases != null ? Collections.unmodifiableList(aliases) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importProcessed(ImportDefinition importDefinition) {
|
||||
this.imports.add(importDefinition);
|
||||
}
|
||||
|
||||
public List<ImportDefinition> getImports() {
|
||||
return Collections.unmodifiableList(this.imports);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
public interface AgeHolder {
|
||||
|
||||
default int age() {
|
||||
return getAge();
|
||||
}
|
||||
|
||||
int getAge();
|
||||
|
||||
void setAge(int age);
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@TestAnnotation
|
||||
public class AnnotatedBean {
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @author Chris Beams
|
||||
* @since 10.06.2003
|
||||
*/
|
||||
public class BooleanTestBean {
|
||||
|
||||
private boolean bool1;
|
||||
|
||||
private Boolean bool2;
|
||||
|
||||
public boolean isBool1() {
|
||||
return bool1;
|
||||
}
|
||||
|
||||
public void setBool1(boolean bool1) {
|
||||
this.bool1 = bool1;
|
||||
}
|
||||
|
||||
public Boolean getBool2() {
|
||||
return bool2;
|
||||
}
|
||||
|
||||
public void setBool2(Boolean bool2) {
|
||||
this.bool2 = bool2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class Colour {
|
||||
|
||||
public static final Colour RED = new Colour("RED");
|
||||
public static final Colour BLUE = new Colour("BLUE");
|
||||
public static final Colour GREEN = new Colour("GREEN");
|
||||
public static final Colour PURPLE = new Colour("PURPLE");
|
||||
|
||||
private final String name;
|
||||
|
||||
public Colour(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @since 15.03.2005
|
||||
*/
|
||||
public class CountingTestBean extends TestBean {
|
||||
|
||||
public static int count = 0;
|
||||
|
||||
public CountingTestBean() {
|
||||
count++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public enum CustomEnum {
|
||||
|
||||
VALUE_1, VALUE_2;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CustomEnum: " + name();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
|
||||
/**
|
||||
* Simple bean used to test dependency checking.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @since 04.09.2003
|
||||
*/
|
||||
public class DependenciesBean implements BeanFactoryAware {
|
||||
|
||||
private int age;
|
||||
|
||||
private String name;
|
||||
|
||||
private TestBean spouse;
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setSpouse(TestBean spouse) {
|
||||
this.spouse = spouse;
|
||||
}
|
||||
|
||||
public TestBean getSpouse() {
|
||||
return spouse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
public BeanFactory getBeanFactory() {
|
||||
return beanFactory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @since 21.08.2003
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class DerivedTestBean extends TestBean implements Serializable, BeanNameAware, DisposableBean {
|
||||
|
||||
private String beanName;
|
||||
|
||||
private boolean initialized;
|
||||
|
||||
private boolean destroyed;
|
||||
|
||||
|
||||
public DerivedTestBean() {
|
||||
}
|
||||
|
||||
public DerivedTestBean(String[] names) {
|
||||
if (names == null || names.length < 2) {
|
||||
throw new IllegalArgumentException("Invalid names array");
|
||||
}
|
||||
setName(names[0]);
|
||||
setBeanName(names[1]);
|
||||
}
|
||||
|
||||
public static DerivedTestBean create(String[] names) {
|
||||
return new DerivedTestBean(names);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
if (this.beanName == null || beanName == null) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBeanName() {
|
||||
return beanName;
|
||||
}
|
||||
|
||||
public void setActualSpouse(TestBean spouse) {
|
||||
setSpouse(spouse);
|
||||
}
|
||||
|
||||
public void setSpouseRef(String name) {
|
||||
setSpouse(new TestBean(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TestBean getSpouse() {
|
||||
return (TestBean) super.getSpouse();
|
||||
}
|
||||
|
||||
|
||||
public void initialize() {
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
public boolean wasInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
this.destroyed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wasDestroyed() {
|
||||
return destroyed;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class DummyBean {
|
||||
|
||||
private Object value;
|
||||
private String name;
|
||||
private int age;
|
||||
private TestBean spouse;
|
||||
|
||||
public DummyBean(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public DummyBean(String name, int age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public DummyBean(int ageRef, String nameRef) {
|
||||
this.name = nameRef;
|
||||
this.age = ageRef;
|
||||
}
|
||||
|
||||
public DummyBean(String name, TestBean spouse) {
|
||||
this.name = name;
|
||||
this.spouse = spouse;
|
||||
}
|
||||
|
||||
public DummyBean(String name, Object value, int age) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public TestBean getSpouse() {
|
||||
return spouse;
|
||||
}
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
|
||||
/**
|
||||
* Simple factory to allow testing of FactoryBean support in AbstractBeanFactory.
|
||||
* Depending on whether its singleton property is set, it will return a singleton
|
||||
* or a prototype instance.
|
||||
*
|
||||
* <p>Implements InitializingBean interface, so we can check that
|
||||
* factories get this lifecycle callback if they want.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Chris Beams
|
||||
* @since 10.03.2003
|
||||
*/
|
||||
public class DummyFactory
|
||||
implements FactoryBean<Object>, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean {
|
||||
|
||||
public static final String SINGLETON_NAME = "Factory singleton";
|
||||
|
||||
private static boolean prototypeCreated;
|
||||
|
||||
/**
|
||||
* Clear static state.
|
||||
*/
|
||||
public static void reset() {
|
||||
prototypeCreated = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Default is for factories to return a singleton instance.
|
||||
*/
|
||||
private boolean singleton = true;
|
||||
|
||||
private String beanName;
|
||||
|
||||
private AutowireCapableBeanFactory beanFactory;
|
||||
|
||||
private boolean postProcessed;
|
||||
|
||||
private boolean initialized;
|
||||
|
||||
private TestBean testBean;
|
||||
|
||||
private TestBean otherTestBean;
|
||||
|
||||
|
||||
public DummyFactory() {
|
||||
this.testBean = new TestBean();
|
||||
this.testBean.setName(SINGLETON_NAME);
|
||||
this.testBean.setAge(25);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the bean managed by this factory is a singleton.
|
||||
* @see FactoryBean#isSingleton()
|
||||
*/
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return this.singleton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the bean managed by this factory is a singleton.
|
||||
*/
|
||||
public void setSingleton(boolean singleton) {
|
||||
this.singleton = singleton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
||||
public String getBeanName() {
|
||||
return beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = (AutowireCapableBeanFactory) beanFactory;
|
||||
this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName);
|
||||
}
|
||||
|
||||
public BeanFactory getBeanFactory() {
|
||||
return beanFactory;
|
||||
}
|
||||
|
||||
public void setPostProcessed(boolean postProcessed) {
|
||||
this.postProcessed = postProcessed;
|
||||
}
|
||||
|
||||
public boolean isPostProcessed() {
|
||||
return postProcessed;
|
||||
}
|
||||
|
||||
public void setOtherTestBean(TestBean otherTestBean) {
|
||||
this.otherTestBean = otherTestBean;
|
||||
this.testBean.setSpouse(otherTestBean);
|
||||
}
|
||||
|
||||
public TestBean getOtherTestBean() {
|
||||
return otherTestBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (initialized) {
|
||||
throw new RuntimeException("Cannot call afterPropertiesSet twice on the one bean");
|
||||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Was this initialized by invocation of the
|
||||
* afterPropertiesSet() method from the InitializingBean interface?
|
||||
*/
|
||||
public boolean wasInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
public static boolean wasPrototypeCreated() {
|
||||
return prototypeCreated;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the managed object, supporting both singleton
|
||||
* and prototype mode.
|
||||
* @see FactoryBean#getObject()
|
||||
*/
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
if (isSingleton()) {
|
||||
return this.testBean;
|
||||
}
|
||||
else {
|
||||
TestBean prototype = new TestBean("prototype created at " + System.currentTimeMillis(), 11);
|
||||
if (this.beanFactory != null) {
|
||||
this.beanFactory.applyBeanPostProcessorsBeforeInitialization(prototype, this.beanName);
|
||||
}
|
||||
prototypeCreated = true;
|
||||
return prototype;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return TestBean.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (this.testBean != null) {
|
||||
this.testBean.setName(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,327 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class GenericBean<T> {
|
||||
|
||||
private Set<Integer> integerSet;
|
||||
|
||||
private Set<? extends Number> numberSet;
|
||||
|
||||
private Set<ITestBean> testBeanSet;
|
||||
|
||||
private List<Resource> resourceList;
|
||||
|
||||
private List<TestBean> testBeanList;
|
||||
|
||||
private List<List<Integer>> listOfLists;
|
||||
|
||||
private ArrayList<String[]> listOfArrays;
|
||||
|
||||
private List<Map<Integer, Long>> listOfMaps;
|
||||
|
||||
private Map<?, ?> plainMap;
|
||||
|
||||
private Map<Short, Integer> shortMap;
|
||||
|
||||
private HashMap<Long, ?> longMap;
|
||||
|
||||
private Map<Number, Collection<? extends Object>> collectionMap;
|
||||
|
||||
private Map<String, Map<Integer, Long>> mapOfMaps;
|
||||
|
||||
private Map<Integer, List<Integer>> mapOfLists;
|
||||
|
||||
private CustomEnum customEnum;
|
||||
|
||||
private CustomEnum[] customEnumArray;
|
||||
|
||||
private Set<CustomEnum> customEnumSet;
|
||||
|
||||
private EnumSet<CustomEnum> standardEnumSet;
|
||||
|
||||
private EnumMap<CustomEnum, Integer> standardEnumMap;
|
||||
|
||||
private T genericProperty;
|
||||
|
||||
private List<T> genericListProperty;
|
||||
|
||||
|
||||
public GenericBean() {
|
||||
}
|
||||
|
||||
public GenericBean(Set<Integer> integerSet) {
|
||||
this.integerSet = integerSet;
|
||||
}
|
||||
|
||||
public GenericBean(Set<Integer> integerSet, List<Resource> resourceList) {
|
||||
this.integerSet = integerSet;
|
||||
this.resourceList = resourceList;
|
||||
}
|
||||
|
||||
public GenericBean(HashSet<Integer> integerSet, Map<Short, Integer> shortMap) {
|
||||
this.integerSet = integerSet;
|
||||
this.shortMap = shortMap;
|
||||
}
|
||||
|
||||
public GenericBean(Map<Short, Integer> shortMap, Resource resource) {
|
||||
this.shortMap = shortMap;
|
||||
this.resourceList = Collections.singletonList(resource);
|
||||
}
|
||||
|
||||
public GenericBean(Map<?, ?> plainMap, Map<Short, Integer> shortMap) {
|
||||
this.plainMap = plainMap;
|
||||
this.shortMap = shortMap;
|
||||
}
|
||||
|
||||
public GenericBean(HashMap<Long, ?> longMap) {
|
||||
this.longMap = longMap;
|
||||
}
|
||||
|
||||
public GenericBean(boolean someFlag, Map<Number, Collection<? extends Object>> collectionMap) {
|
||||
this.collectionMap = collectionMap;
|
||||
}
|
||||
|
||||
|
||||
public Set<Integer> getIntegerSet() {
|
||||
return integerSet;
|
||||
}
|
||||
|
||||
public void setIntegerSet(Set<Integer> integerSet) {
|
||||
this.integerSet = integerSet;
|
||||
}
|
||||
|
||||
public Set<? extends Number> getNumberSet() {
|
||||
return numberSet;
|
||||
}
|
||||
|
||||
public void setNumberSet(Set<? extends Number> numberSet) {
|
||||
this.numberSet = numberSet;
|
||||
}
|
||||
|
||||
public Set<ITestBean> getTestBeanSet() {
|
||||
return testBeanSet;
|
||||
}
|
||||
|
||||
public void setTestBeanSet(Set<ITestBean> testBeanSet) {
|
||||
this.testBeanSet = testBeanSet;
|
||||
}
|
||||
|
||||
public List<Resource> getResourceList() {
|
||||
return resourceList;
|
||||
}
|
||||
|
||||
public void setResourceList(List<Resource> resourceList) {
|
||||
this.resourceList = resourceList;
|
||||
}
|
||||
|
||||
public List<TestBean> getTestBeanList() {
|
||||
return testBeanList;
|
||||
}
|
||||
|
||||
public void setTestBeanList(List<TestBean> testBeanList) {
|
||||
this.testBeanList = testBeanList;
|
||||
}
|
||||
|
||||
public List<List<Integer>> getListOfLists() {
|
||||
return listOfLists;
|
||||
}
|
||||
|
||||
public ArrayList<String[]> getListOfArrays() {
|
||||
return listOfArrays;
|
||||
}
|
||||
|
||||
public void setListOfArrays(ArrayList<String[]> listOfArrays) {
|
||||
this.listOfArrays = listOfArrays;
|
||||
}
|
||||
|
||||
public void setListOfLists(List<List<Integer>> listOfLists) {
|
||||
this.listOfLists = listOfLists;
|
||||
}
|
||||
|
||||
public List<Map<Integer, Long>> getListOfMaps() {
|
||||
return listOfMaps;
|
||||
}
|
||||
|
||||
public void setListOfMaps(List<Map<Integer, Long>> listOfMaps) {
|
||||
this.listOfMaps = listOfMaps;
|
||||
}
|
||||
|
||||
public Map<?, ?> getPlainMap() {
|
||||
return plainMap;
|
||||
}
|
||||
|
||||
public Map<Short, Integer> getShortMap() {
|
||||
return shortMap;
|
||||
}
|
||||
|
||||
public void setShortMap(Map<Short, Integer> shortMap) {
|
||||
this.shortMap = shortMap;
|
||||
}
|
||||
|
||||
public HashMap<Long, ?> getLongMap() {
|
||||
return longMap;
|
||||
}
|
||||
|
||||
public void setLongMap(HashMap<Long, ?> longMap) {
|
||||
this.longMap = longMap;
|
||||
}
|
||||
|
||||
public Map<Number, Collection<? extends Object>> getCollectionMap() {
|
||||
return collectionMap;
|
||||
}
|
||||
|
||||
public void setCollectionMap(Map<Number, Collection<? extends Object>> collectionMap) {
|
||||
this.collectionMap = collectionMap;
|
||||
}
|
||||
|
||||
public Map<String, Map<Integer, Long>> getMapOfMaps() {
|
||||
return mapOfMaps;
|
||||
}
|
||||
|
||||
public void setMapOfMaps(Map<String, Map<Integer, Long>> mapOfMaps) {
|
||||
this.mapOfMaps = mapOfMaps;
|
||||
}
|
||||
|
||||
public Map<Integer, List<Integer>> getMapOfLists() {
|
||||
return mapOfLists;
|
||||
}
|
||||
|
||||
public void setMapOfLists(Map<Integer, List<Integer>> mapOfLists) {
|
||||
this.mapOfLists = mapOfLists;
|
||||
}
|
||||
|
||||
public T getGenericProperty() {
|
||||
return genericProperty;
|
||||
}
|
||||
|
||||
public void setGenericProperty(T genericProperty) {
|
||||
this.genericProperty = genericProperty;
|
||||
}
|
||||
|
||||
public List<T> getGenericListProperty() {
|
||||
return genericListProperty;
|
||||
}
|
||||
|
||||
public void setGenericListProperty(List<T> genericListProperty) {
|
||||
this.genericListProperty = genericListProperty;
|
||||
}
|
||||
|
||||
public CustomEnum getCustomEnum() {
|
||||
return customEnum;
|
||||
}
|
||||
|
||||
public void setCustomEnum(CustomEnum customEnum) {
|
||||
this.customEnum = customEnum;
|
||||
}
|
||||
|
||||
public CustomEnum[] getCustomEnumArray() {
|
||||
return customEnumArray;
|
||||
}
|
||||
|
||||
public void setCustomEnumArray(CustomEnum[] customEnum) {
|
||||
this.customEnumArray = customEnum;
|
||||
}
|
||||
|
||||
public Set<CustomEnum> getCustomEnumSet() {
|
||||
return customEnumSet;
|
||||
}
|
||||
|
||||
public void setCustomEnumSet(Set<CustomEnum> customEnumSet) {
|
||||
this.customEnumSet = customEnumSet;
|
||||
}
|
||||
|
||||
public Set<CustomEnum> getCustomEnumSetMismatch() {
|
||||
return customEnumSet;
|
||||
}
|
||||
|
||||
public void setCustomEnumSetMismatch(Set<String> customEnumSet) {
|
||||
this.customEnumSet = new HashSet<>(customEnumSet.size());
|
||||
for (Iterator<String> iterator = customEnumSet.iterator(); iterator.hasNext(); ) {
|
||||
this.customEnumSet.add(CustomEnum.valueOf(iterator.next()));
|
||||
}
|
||||
}
|
||||
|
||||
public EnumSet<CustomEnum> getStandardEnumSet() {
|
||||
return standardEnumSet;
|
||||
}
|
||||
|
||||
public void setStandardEnumSet(EnumSet<CustomEnum> standardEnumSet) {
|
||||
this.standardEnumSet = standardEnumSet;
|
||||
}
|
||||
|
||||
public EnumMap<CustomEnum, Integer> getStandardEnumMap() {
|
||||
return standardEnumMap;
|
||||
}
|
||||
|
||||
public void setStandardEnumMap(EnumMap<CustomEnum, Integer> standardEnumMap) {
|
||||
this.standardEnumMap = standardEnumMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(Set<Integer> integerSet) {
|
||||
return new GenericBean(integerSet);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(Set<Integer> integerSet, List<Resource> resourceList) {
|
||||
return new GenericBean(integerSet, resourceList);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(HashSet<Integer> integerSet, Map<Short, Integer> shortMap) {
|
||||
return new GenericBean(integerSet, shortMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(Map<Short, Integer> shortMap, Resource resource) {
|
||||
return new GenericBean(shortMap, resource);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(Map map, Map<Short, Integer> shortMap) {
|
||||
return new GenericBean(map, shortMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(HashMap<Long, ?> longMap) {
|
||||
return new GenericBean(longMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static GenericBean createInstance(boolean someFlag, Map<Number, Collection<? extends Object>> collectionMap) {
|
||||
return new GenericBean(someFlag, collectionMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class GenericIntegerBean extends GenericBean<Integer> {
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class GenericSetOfIntegerBean extends GenericBean<Set<Integer>> {
|
||||
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
/**
|
||||
* Bean exposing a map. Used for bean factory tests.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @since 05.06.2003
|
||||
*/
|
||||
public class HasMap {
|
||||
|
||||
private Map<?, ?> map;
|
||||
|
||||
private Set<?> set;
|
||||
|
||||
private Properties props;
|
||||
|
||||
private Object[] objectArray;
|
||||
|
||||
private Integer[] intArray;
|
||||
|
||||
private Class<?>[] classArray;
|
||||
|
||||
private List<Class<?>> classList;
|
||||
|
||||
private IdentityHashMap<?, ?> identityMap;
|
||||
|
||||
private CopyOnWriteArraySet<?> concurrentSet;
|
||||
|
||||
private HasMap() {
|
||||
}
|
||||
|
||||
public Map<?, ?> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void setMap(Map<?, ?> map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public Set<?> getSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
public void setSet(Set<?> set) {
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
public Properties getProps() {
|
||||
return props;
|
||||
}
|
||||
|
||||
public void setProps(Properties props) {
|
||||
this.props = props;
|
||||
}
|
||||
|
||||
public Object[] getObjectArray() {
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public void setObjectArray(Object[] objectArray) {
|
||||
this.objectArray = objectArray;
|
||||
}
|
||||
|
||||
public Integer[] getIntegerArray() {
|
||||
return intArray;
|
||||
}
|
||||
|
||||
public void setIntegerArray(Integer[] is) {
|
||||
intArray = is;
|
||||
}
|
||||
|
||||
public Class<?>[] getClassArray() {
|
||||
return classArray;
|
||||
}
|
||||
|
||||
public void setClassArray(Class<?>[] classArray) {
|
||||
this.classArray = classArray;
|
||||
}
|
||||
|
||||
public List<Class<?>> getClassList() {
|
||||
return classList;
|
||||
}
|
||||
|
||||
public void setClassList(List<Class<?>> classList) {
|
||||
this.classList = classList;
|
||||
}
|
||||
|
||||
public IdentityHashMap<?, ?> getIdentityMap() {
|
||||
return identityMap;
|
||||
}
|
||||
|
||||
public void setIdentityMap(IdentityHashMap<?, ?> identityMap) {
|
||||
this.identityMap = identityMap;
|
||||
}
|
||||
|
||||
public CopyOnWriteArraySet<?> getConcurrentSet() {
|
||||
return concurrentSet;
|
||||
}
|
||||
|
||||
public void setConcurrentSet(CopyOnWriteArraySet<?> concurrentSet) {
|
||||
this.concurrentSet = concurrentSet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
public interface INestedTestBean {
|
||||
|
||||
public String getCompany();
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
public interface IOther {
|
||||
|
||||
void absquatulate();
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Interface used for {@link org.springframework.tests.sample.beans.TestBean}.
|
||||
*
|
||||
* <p>Two methods are the same as on Person, but if this
|
||||
* extends person it breaks quite a few tests..
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public interface ITestBean extends AgeHolder {
|
||||
|
||||
String getName();
|
||||
|
||||
void setName(String name);
|
||||
|
||||
ITestBean getSpouse();
|
||||
|
||||
void setSpouse(ITestBean spouse);
|
||||
|
||||
ITestBean[] getSpouses();
|
||||
|
||||
String[] getStringArray();
|
||||
|
||||
void setStringArray(String[] stringArray);
|
||||
|
||||
Integer[][] getNestedIntegerArray();
|
||||
|
||||
Integer[] getSomeIntegerArray();
|
||||
|
||||
void setSomeIntegerArray(Integer[] someIntegerArray);
|
||||
|
||||
void setNestedIntegerArray(Integer[][] nestedIntegerArray);
|
||||
|
||||
int[] getSomeIntArray();
|
||||
|
||||
void setSomeIntArray(int[] someIntArray);
|
||||
|
||||
int[][] getNestedIntArray();
|
||||
|
||||
void setNestedIntArray(int[][] someNestedArray);
|
||||
|
||||
/**
|
||||
* Throws a given (non-null) exception.
|
||||
*/
|
||||
void exceptional(Throwable t) throws Throwable;
|
||||
|
||||
Object returnsThis();
|
||||
|
||||
INestedTestBean getDoctor();
|
||||
|
||||
INestedTestBean getLawyer();
|
||||
|
||||
IndexedTestBean getNestedIndexedBean();
|
||||
|
||||
/**
|
||||
* Increment the age by one.
|
||||
* @return the previous age
|
||||
*/
|
||||
int haveBirthday();
|
||||
|
||||
void unreliableFileOperation() throws IOException;
|
||||
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @since 11.11.2003
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class IndexedTestBean {
|
||||
|
||||
private TestBean[] array;
|
||||
|
||||
private Collection<?> collection;
|
||||
|
||||
private List list;
|
||||
|
||||
private Set<? super Object> set;
|
||||
|
||||
private SortedSet<? super Object> sortedSet;
|
||||
|
||||
private Map map;
|
||||
|
||||
private SortedMap sortedMap;
|
||||
|
||||
|
||||
public IndexedTestBean() {
|
||||
this(true);
|
||||
}
|
||||
|
||||
public IndexedTestBean(boolean populate) {
|
||||
if (populate) {
|
||||
populate();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void populate() {
|
||||
TestBean tb0 = new TestBean("name0", 0);
|
||||
TestBean tb1 = new TestBean("name1", 0);
|
||||
TestBean tb2 = new TestBean("name2", 0);
|
||||
TestBean tb3 = new TestBean("name3", 0);
|
||||
TestBean tb4 = new TestBean("name4", 0);
|
||||
TestBean tb5 = new TestBean("name5", 0);
|
||||
TestBean tb6 = new TestBean("name6", 0);
|
||||
TestBean tb7 = new TestBean("name7", 0);
|
||||
TestBean tb8 = new TestBean("name8", 0);
|
||||
TestBean tbX = new TestBean("nameX", 0);
|
||||
TestBean tbY = new TestBean("nameY", 0);
|
||||
this.array = new TestBean[] {tb0, tb1};
|
||||
this.list = new ArrayList<>();
|
||||
this.list.add(tb2);
|
||||
this.list.add(tb3);
|
||||
this.set = new TreeSet<>();
|
||||
this.set.add(tb6);
|
||||
this.set.add(tb7);
|
||||
this.map = new HashMap<>();
|
||||
this.map.put("key1", tb4);
|
||||
this.map.put("key2", tb5);
|
||||
this.map.put("key.3", tb5);
|
||||
List list = new ArrayList();
|
||||
list.add(tbX);
|
||||
list.add(tbY);
|
||||
this.map.put("key4", list);
|
||||
this.map.put("key5[foo]", tb8);
|
||||
}
|
||||
|
||||
|
||||
public TestBean[] getArray() {
|
||||
return array;
|
||||
}
|
||||
|
||||
public void setArray(TestBean[] array) {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
public Collection<?> getCollection() {
|
||||
return collection;
|
||||
}
|
||||
|
||||
public void setCollection(Collection<?> collection) {
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
public List getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public Set<?> getSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
public void setSet(Set<? super Object> set) {
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
public SortedSet<? super Object> getSortedSet() {
|
||||
return sortedSet;
|
||||
}
|
||||
|
||||
public void setSortedSet(SortedSet<? super Object> sortedSet) {
|
||||
this.sortedSet = sortedSet;
|
||||
}
|
||||
|
||||
public Map getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void setMap(Map map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public SortedMap getSortedMap() {
|
||||
return sortedMap;
|
||||
}
|
||||
|
||||
public void setSortedMap(SortedMap sortedMap) {
|
||||
this.sortedMap = sortedMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
|
||||
/**
|
||||
* Simple test of BeanFactory initialization and lifecycle callbacks.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Colin Sampaleanu
|
||||
* @author Chris Beams
|
||||
* @since 12.03.2003
|
||||
*/
|
||||
public class LifecycleBean implements BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean {
|
||||
|
||||
protected boolean initMethodDeclared = false;
|
||||
|
||||
protected String beanName;
|
||||
|
||||
protected BeanFactory owningFactory;
|
||||
|
||||
protected boolean postProcessedBeforeInit;
|
||||
|
||||
protected boolean inited;
|
||||
|
||||
protected boolean initedViaDeclaredInitMethod;
|
||||
|
||||
protected boolean postProcessedAfterInit;
|
||||
|
||||
protected boolean destroyed;
|
||||
|
||||
|
||||
public void setInitMethodDeclared(boolean initMethodDeclared) {
|
||||
this.initMethodDeclared = initMethodDeclared;
|
||||
}
|
||||
|
||||
public boolean isInitMethodDeclared() {
|
||||
return initMethodDeclared;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanName(String name) {
|
||||
this.beanName = name;
|
||||
}
|
||||
|
||||
public String getBeanName() {
|
||||
return beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.owningFactory = beanFactory;
|
||||
}
|
||||
|
||||
public void postProcessBeforeInit() {
|
||||
if (this.inited || this.initedViaDeclaredInitMethod) {
|
||||
throw new RuntimeException("Factory called postProcessBeforeInit after afterPropertiesSet");
|
||||
}
|
||||
if (this.postProcessedBeforeInit) {
|
||||
throw new RuntimeException("Factory called postProcessBeforeInit twice");
|
||||
}
|
||||
this.postProcessedBeforeInit = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (this.owningFactory == null) {
|
||||
throw new RuntimeException("Factory didn't call setBeanFactory before afterPropertiesSet on lifecycle bean");
|
||||
}
|
||||
if (!this.postProcessedBeforeInit) {
|
||||
throw new RuntimeException("Factory didn't call postProcessBeforeInit before afterPropertiesSet on lifecycle bean");
|
||||
}
|
||||
if (this.initedViaDeclaredInitMethod) {
|
||||
throw new RuntimeException("Factory initialized via declared init method before initializing via afterPropertiesSet");
|
||||
}
|
||||
if (this.inited) {
|
||||
throw new RuntimeException("Factory called afterPropertiesSet twice");
|
||||
}
|
||||
this.inited = true;
|
||||
}
|
||||
|
||||
public void declaredInitMethod() {
|
||||
if (!this.inited) {
|
||||
throw new RuntimeException("Factory didn't call afterPropertiesSet before declared init method");
|
||||
}
|
||||
|
||||
if (this.initedViaDeclaredInitMethod) {
|
||||
throw new RuntimeException("Factory called declared init method twice");
|
||||
}
|
||||
this.initedViaDeclaredInitMethod = true;
|
||||
}
|
||||
|
||||
public void postProcessAfterInit() {
|
||||
if (!this.inited) {
|
||||
throw new RuntimeException("Factory called postProcessAfterInit before afterPropertiesSet");
|
||||
}
|
||||
if (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) {
|
||||
throw new RuntimeException("Factory called postProcessAfterInit before calling declared init method");
|
||||
}
|
||||
if (this.postProcessedAfterInit) {
|
||||
throw new RuntimeException("Factory called postProcessAfterInit twice");
|
||||
}
|
||||
this.postProcessedAfterInit = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dummy business method that will fail unless the factory
|
||||
* managed the bean's lifecycle correctly
|
||||
*/
|
||||
public void businessMethod() {
|
||||
if (!this.inited || (this.initMethodDeclared && !this.initedViaDeclaredInitMethod) ||
|
||||
!this.postProcessedAfterInit) {
|
||||
throw new RuntimeException("Factory didn't initialize lifecycle object correctly");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (this.destroyed) {
|
||||
throw new IllegalStateException("Already destroyed");
|
||||
}
|
||||
this.destroyed = true;
|
||||
}
|
||||
|
||||
public boolean isDestroyed() {
|
||||
return destroyed;
|
||||
}
|
||||
|
||||
|
||||
public static class PostProcessor implements BeanPostProcessor {
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
||||
if (bean instanceof LifecycleBean) {
|
||||
((LifecycleBean) bean).postProcessBeforeInit();
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
|
||||
if (bean instanceof LifecycleBean) {
|
||||
((LifecycleBean) bean).postProcessAfterInit();
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* Simple test of BeanFactory initialization
|
||||
* @author Rod Johnson
|
||||
* @since 12.03.2003
|
||||
*/
|
||||
public class MustBeInitialized implements InitializingBean {
|
||||
|
||||
private boolean inited;
|
||||
|
||||
/**
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
this.inited = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dummy business method that will fail unless the factory
|
||||
* managed the bean's lifecycle correctly
|
||||
*/
|
||||
public void businessMethod() {
|
||||
if (!this.inited)
|
||||
throw new RuntimeException("Factory didn't call afterPropertiesSet() on MustBeInitialized object");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* Simple nested test bean used for testing bean factories, AOP framework etc.
|
||||
*
|
||||
* @author Trevor D. Cook
|
||||
* @since 30.09.2003
|
||||
*/
|
||||
public class NestedTestBean implements INestedTestBean {
|
||||
|
||||
private String company = "";
|
||||
|
||||
public NestedTestBean() {
|
||||
}
|
||||
|
||||
public NestedTestBean(String company) {
|
||||
setCompany(company);
|
||||
}
|
||||
|
||||
public void setCompany(String company) {
|
||||
this.company = (company != null ? company : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCompany() {
|
||||
return company;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof NestedTestBean)) {
|
||||
return false;
|
||||
}
|
||||
NestedTestBean ntb = (NestedTestBean) obj;
|
||||
return this.company.equals(ntb.company);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.company.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NestedTestBean: " + this.company;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* @author Juergen Hoeller
|
||||
* @since 10.06.2003
|
||||
*/
|
||||
public class NumberTestBean {
|
||||
|
||||
private short short1;
|
||||
private Short short2;
|
||||
|
||||
private int int1;
|
||||
private Integer int2;
|
||||
|
||||
private long long1;
|
||||
private Long long2;
|
||||
|
||||
private BigInteger bigInteger;
|
||||
|
||||
private float float1;
|
||||
private Float float2;
|
||||
|
||||
private double double1;
|
||||
private Double double2;
|
||||
|
||||
private BigDecimal bigDecimal;
|
||||
|
||||
public short getShort1() {
|
||||
return short1;
|
||||
}
|
||||
|
||||
public void setShort1(short short1) {
|
||||
this.short1 = short1;
|
||||
}
|
||||
|
||||
public Short getShort2() {
|
||||
return short2;
|
||||
}
|
||||
|
||||
public void setShort2(Short short2) {
|
||||
this.short2 = short2;
|
||||
}
|
||||
|
||||
public int getInt1() {
|
||||
return int1;
|
||||
}
|
||||
|
||||
public void setInt1(int int1) {
|
||||
this.int1 = int1;
|
||||
}
|
||||
|
||||
public Integer getInt2() {
|
||||
return int2;
|
||||
}
|
||||
|
||||
public void setInt2(Integer int2) {
|
||||
this.int2 = int2;
|
||||
}
|
||||
|
||||
public long getLong1() {
|
||||
return long1;
|
||||
}
|
||||
|
||||
public void setLong1(long long1) {
|
||||
this.long1 = long1;
|
||||
}
|
||||
|
||||
public Long getLong2() {
|
||||
return long2;
|
||||
}
|
||||
|
||||
public void setLong2(Long long2) {
|
||||
this.long2 = long2;
|
||||
}
|
||||
|
||||
public BigInteger getBigInteger() {
|
||||
return bigInteger;
|
||||
}
|
||||
|
||||
public void setBigInteger(BigInteger bigInteger) {
|
||||
this.bigInteger = bigInteger;
|
||||
}
|
||||
|
||||
public float getFloat1() {
|
||||
return float1;
|
||||
}
|
||||
|
||||
public void setFloat1(float float1) {
|
||||
this.float1 = float1;
|
||||
}
|
||||
|
||||
public Float getFloat2() {
|
||||
return float2;
|
||||
}
|
||||
|
||||
public void setFloat2(Float float2) {
|
||||
this.float2 = float2;
|
||||
}
|
||||
|
||||
public double getDouble1() {
|
||||
return double1;
|
||||
}
|
||||
|
||||
public void setDouble1(double double1) {
|
||||
this.double1 = double1;
|
||||
}
|
||||
|
||||
public Double getDouble2() {
|
||||
return double2;
|
||||
}
|
||||
|
||||
public void setDouble2(Double double2) {
|
||||
this.double2 = double2;
|
||||
}
|
||||
|
||||
public BigDecimal getBigDecimal() {
|
||||
return bigDecimal;
|
||||
}
|
||||
|
||||
public void setBigDecimal(BigDecimal bigDecimal) {
|
||||
this.bigDecimal = bigDecimal;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* @see org.springframework.beans.factory.config.FieldRetrievingFactoryBeanTests
|
||||
*
|
||||
* @author Rick Evans
|
||||
* @author Chris Beams
|
||||
*/
|
||||
class PackageLevelVisibleBean {
|
||||
|
||||
public static final String CONSTANT = "Wuby";
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2006 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
* @since 2.0
|
||||
*/
|
||||
public class Pet {
|
||||
|
||||
private String name;
|
||||
|
||||
public Pet(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final Pet pet = (Pet) o;
|
||||
|
||||
if (name != null ? !name.equals(pet.name) : pet.name != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (name != null ? name.hashCode() : 0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
/**
|
||||
* Bean that changes state on a business invocation, so that
|
||||
* we can check whether it's been invoked
|
||||
* @author Rod Johnson
|
||||
*/
|
||||
public class SideEffectBean {
|
||||
|
||||
private int count;
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
public void doWork() {
|
||||
++count;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TestAnnotation {
|
||||
}
|
||||
@@ -1,499 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Simple test bean used for testing bean factories, the AOP framework etc.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Stephane Nicoll
|
||||
* @since 15 April 2001
|
||||
*/
|
||||
public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable<Object> {
|
||||
|
||||
private String beanName;
|
||||
|
||||
private String country;
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
private boolean postProcessed;
|
||||
|
||||
private String name;
|
||||
|
||||
private String sex;
|
||||
|
||||
private int age;
|
||||
|
||||
private boolean jedi;
|
||||
|
||||
private ITestBean spouse;
|
||||
|
||||
private String touchy;
|
||||
|
||||
private String[] stringArray;
|
||||
|
||||
private Integer[] someIntegerArray;
|
||||
|
||||
private Integer[][] nestedIntegerArray;
|
||||
|
||||
private int[] someIntArray;
|
||||
|
||||
private int[][] nestedIntArray;
|
||||
|
||||
private Date date = new Date();
|
||||
|
||||
private Float myFloat = new Float(0.0);
|
||||
|
||||
private Collection<? super Object> friends = new LinkedList<>();
|
||||
|
||||
private Set<?> someSet = new HashSet<>();
|
||||
|
||||
private Map<?, ?> someMap = new HashMap<>();
|
||||
|
||||
private List<?> someList = new ArrayList<>();
|
||||
|
||||
private Properties someProperties = new Properties();
|
||||
|
||||
private INestedTestBean doctor = new NestedTestBean();
|
||||
|
||||
private INestedTestBean lawyer = new NestedTestBean();
|
||||
|
||||
private IndexedTestBean nestedIndexedBean;
|
||||
|
||||
private boolean destroyed;
|
||||
|
||||
private Number someNumber;
|
||||
|
||||
private Colour favouriteColour;
|
||||
|
||||
private Boolean someBoolean;
|
||||
|
||||
private List<?> otherColours;
|
||||
|
||||
private List<?> pets;
|
||||
|
||||
|
||||
public TestBean() {
|
||||
}
|
||||
|
||||
public TestBean(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public TestBean(ITestBean spouse) {
|
||||
this.spouse = spouse;
|
||||
}
|
||||
|
||||
public TestBean(String name, int age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public TestBean(ITestBean spouse, Properties someProperties) {
|
||||
this.spouse = spouse;
|
||||
this.someProperties = someProperties;
|
||||
}
|
||||
|
||||
public TestBean(List<?> someList) {
|
||||
this.someList = someList;
|
||||
}
|
||||
|
||||
public TestBean(Set<?> someSet) {
|
||||
this.someSet = someSet;
|
||||
}
|
||||
|
||||
public TestBean(Map<?, ?> someMap) {
|
||||
this.someMap = someMap;
|
||||
}
|
||||
|
||||
public TestBean(Properties someProperties) {
|
||||
this.someProperties = someProperties;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
||||
public String getBeanName() {
|
||||
return beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
public BeanFactory getBeanFactory() {
|
||||
return beanFactory;
|
||||
}
|
||||
|
||||
public void setPostProcessed(boolean postProcessed) {
|
||||
this.postProcessed = postProcessed;
|
||||
}
|
||||
|
||||
public boolean isPostProcessed() {
|
||||
return postProcessed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
if (this.name == null) {
|
||||
this.name = sex;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public boolean isJedi() {
|
||||
return jedi;
|
||||
}
|
||||
|
||||
public void setJedi(boolean jedi) {
|
||||
this.jedi = jedi;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITestBean getSpouse() {
|
||||
return this.spouse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpouse(ITestBean spouse) {
|
||||
this.spouse = spouse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITestBean[] getSpouses() {
|
||||
return (spouse != null ? new ITestBean[] {spouse} : null);
|
||||
}
|
||||
|
||||
public String getTouchy() {
|
||||
return touchy;
|
||||
}
|
||||
|
||||
public void setTouchy(String touchy) throws Exception {
|
||||
if (touchy.indexOf('.') != -1) {
|
||||
throw new Exception("Can't contain a .");
|
||||
}
|
||||
if (touchy.indexOf(',') != -1) {
|
||||
throw new NumberFormatException("Number format exception: contains a ,");
|
||||
}
|
||||
this.touchy = touchy;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStringArray() {
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStringArray(String[] stringArray) {
|
||||
this.stringArray = stringArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer[] getSomeIntegerArray() {
|
||||
return someIntegerArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSomeIntegerArray(Integer[] someIntegerArray) {
|
||||
this.someIntegerArray = someIntegerArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer[][] getNestedIntegerArray() {
|
||||
return nestedIntegerArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNestedIntegerArray(Integer[][] nestedIntegerArray) {
|
||||
this.nestedIntegerArray = nestedIntegerArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSomeIntArray() {
|
||||
return someIntArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSomeIntArray(int[] someIntArray) {
|
||||
this.someIntArray = someIntArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[][] getNestedIntArray() {
|
||||
return nestedIntArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNestedIntArray(int[][] nestedIntArray) {
|
||||
this.nestedIntArray = nestedIntArray;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Float getMyFloat() {
|
||||
return myFloat;
|
||||
}
|
||||
|
||||
public void setMyFloat(Float myFloat) {
|
||||
this.myFloat = myFloat;
|
||||
}
|
||||
|
||||
public Collection<? super Object> getFriends() {
|
||||
return friends;
|
||||
}
|
||||
|
||||
public void setFriends(Collection<? super Object> friends) {
|
||||
this.friends = friends;
|
||||
}
|
||||
|
||||
public Set<?> getSomeSet() {
|
||||
return someSet;
|
||||
}
|
||||
|
||||
public void setSomeSet(Set<?> someSet) {
|
||||
this.someSet = someSet;
|
||||
}
|
||||
|
||||
public Map<?, ?> getSomeMap() {
|
||||
return someMap;
|
||||
}
|
||||
|
||||
public void setSomeMap(Map<?, ?> someMap) {
|
||||
this.someMap = someMap;
|
||||
}
|
||||
|
||||
public List<?> getSomeList() {
|
||||
return someList;
|
||||
}
|
||||
|
||||
public void setSomeList(List<?> someList) {
|
||||
this.someList = someList;
|
||||
}
|
||||
|
||||
public Properties getSomeProperties() {
|
||||
return someProperties;
|
||||
}
|
||||
|
||||
public void setSomeProperties(Properties someProperties) {
|
||||
this.someProperties = someProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public INestedTestBean getDoctor() {
|
||||
return doctor;
|
||||
}
|
||||
|
||||
public void setDoctor(INestedTestBean doctor) {
|
||||
this.doctor = doctor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public INestedTestBean getLawyer() {
|
||||
return lawyer;
|
||||
}
|
||||
|
||||
public void setLawyer(INestedTestBean lawyer) {
|
||||
this.lawyer = lawyer;
|
||||
}
|
||||
|
||||
public Number getSomeNumber() {
|
||||
return someNumber;
|
||||
}
|
||||
|
||||
public void setSomeNumber(Number someNumber) {
|
||||
this.someNumber = someNumber;
|
||||
}
|
||||
|
||||
public Colour getFavouriteColour() {
|
||||
return favouriteColour;
|
||||
}
|
||||
|
||||
public void setFavouriteColour(Colour favouriteColour) {
|
||||
this.favouriteColour = favouriteColour;
|
||||
}
|
||||
|
||||
public Boolean getSomeBoolean() {
|
||||
return someBoolean;
|
||||
}
|
||||
|
||||
public void setSomeBoolean(Boolean someBoolean) {
|
||||
this.someBoolean = someBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndexedTestBean getNestedIndexedBean() {
|
||||
return nestedIndexedBean;
|
||||
}
|
||||
|
||||
public void setNestedIndexedBean(IndexedTestBean nestedIndexedBean) {
|
||||
this.nestedIndexedBean = nestedIndexedBean;
|
||||
}
|
||||
|
||||
public List<?> getOtherColours() {
|
||||
return otherColours;
|
||||
}
|
||||
|
||||
public void setOtherColours(List<?> otherColours) {
|
||||
this.otherColours = otherColours;
|
||||
}
|
||||
|
||||
public List<?> getPets() {
|
||||
return pets;
|
||||
}
|
||||
|
||||
public void setPets(List<?> pets) {
|
||||
this.pets = pets;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.springframework.tests.sample.beans.ITestBean#exceptional(Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void exceptional(Throwable t) throws Throwable {
|
||||
if (t != null) {
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unreliableFileOperation() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
/**
|
||||
* @see org.springframework.tests.sample.beans.ITestBean#returnsThis()
|
||||
*/
|
||||
@Override
|
||||
public Object returnsThis() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.springframework.tests.sample.beans.IOther#absquatulate()
|
||||
*/
|
||||
@Override
|
||||
public void absquatulate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int haveBirthday() {
|
||||
return age++;
|
||||
}
|
||||
|
||||
|
||||
public void destroy() {
|
||||
this.destroyed = true;
|
||||
}
|
||||
|
||||
public boolean wasDestroyed() {
|
||||
return destroyed;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (other == null || !(other instanceof TestBean)) {
|
||||
return false;
|
||||
}
|
||||
TestBean tb2 = (TestBean) other;
|
||||
return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object other) {
|
||||
if (this.name != null && other instanceof TestBean) {
|
||||
return this.name.compareTo(((TestBean) other).getName());
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.tests.sample.beans.factory;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
import org.springframework.tests.sample.beans.TestBean;
|
||||
|
||||
/**
|
||||
* Simple factory to allow testing of FactoryBean support in AbstractBeanFactory.
|
||||
* Depending on whether its singleton property is set, it will return a singleton
|
||||
* or a prototype instance.
|
||||
*
|
||||
* <p>Implements InitializingBean interface, so we can check that
|
||||
* factories get this lifecycle callback if they want.
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Chris Beams
|
||||
* @since 10.03.2003
|
||||
*/
|
||||
public class DummyFactory
|
||||
implements FactoryBean<Object>, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean {
|
||||
|
||||
public static final String SINGLETON_NAME = "Factory singleton";
|
||||
|
||||
private static boolean prototypeCreated;
|
||||
|
||||
/**
|
||||
* Clear static state.
|
||||
*/
|
||||
public static void reset() {
|
||||
prototypeCreated = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Default is for factories to return a singleton instance.
|
||||
*/
|
||||
private boolean singleton = true;
|
||||
|
||||
private String beanName;
|
||||
|
||||
private AutowireCapableBeanFactory beanFactory;
|
||||
|
||||
private boolean postProcessed;
|
||||
|
||||
private boolean initialized;
|
||||
|
||||
private TestBean testBean;
|
||||
|
||||
private TestBean otherTestBean;
|
||||
|
||||
|
||||
public DummyFactory() {
|
||||
this.testBean = new TestBean();
|
||||
this.testBean.setName(SINGLETON_NAME);
|
||||
this.testBean.setAge(25);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the bean managed by this factory is a singleton.
|
||||
* @see FactoryBean#isSingleton()
|
||||
*/
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return this.singleton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the bean managed by this factory is a singleton.
|
||||
*/
|
||||
public void setSingleton(boolean singleton) {
|
||||
this.singleton = singleton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
||||
public String getBeanName() {
|
||||
return beanName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = (AutowireCapableBeanFactory) beanFactory;
|
||||
this.beanFactory.applyBeanPostProcessorsBeforeInitialization(this.testBean, this.beanName);
|
||||
}
|
||||
|
||||
public BeanFactory getBeanFactory() {
|
||||
return beanFactory;
|
||||
}
|
||||
|
||||
public void setPostProcessed(boolean postProcessed) {
|
||||
this.postProcessed = postProcessed;
|
||||
}
|
||||
|
||||
public boolean isPostProcessed() {
|
||||
return postProcessed;
|
||||
}
|
||||
|
||||
public void setOtherTestBean(TestBean otherTestBean) {
|
||||
this.otherTestBean = otherTestBean;
|
||||
this.testBean.setSpouse(otherTestBean);
|
||||
}
|
||||
|
||||
public TestBean getOtherTestBean() {
|
||||
return otherTestBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (initialized) {
|
||||
throw new RuntimeException("Cannot call afterPropertiesSet twice on the one bean");
|
||||
}
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Was this initialized by invocation of the
|
||||
* afterPropertiesSet() method from the InitializingBean interface?
|
||||
*/
|
||||
public boolean wasInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
|
||||
public static boolean wasPrototypeCreated() {
|
||||
return prototypeCreated;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the managed object, supporting both singleton
|
||||
* and prototype mode.
|
||||
* @see FactoryBean#getObject()
|
||||
*/
|
||||
@Override
|
||||
public Object getObject() throws BeansException {
|
||||
if (isSingleton()) {
|
||||
return this.testBean;
|
||||
}
|
||||
else {
|
||||
TestBean prototype = new TestBean("prototype created at " + System.currentTimeMillis(), 11);
|
||||
if (this.beanFactory != null) {
|
||||
this.beanFactory.applyBeanPostProcessorsBeforeInitialization(prototype, this.beanName);
|
||||
}
|
||||
prototypeCreated = true;
|
||||
return prototype;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return TestBean.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (this.testBean != null) {
|
||||
this.testBean.setName(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* General purpose sample beans that can be used with tests.
|
||||
*/
|
||||
package org.springframework.tests.sample.beans;
|
||||
@@ -22,8 +22,8 @@ import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.BeanCreationException
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition
|
||||
import org.springframework.tests.sample.beans.Colour
|
||||
import org.springframework.tests.sample.beans.TestBean
|
||||
import org.springframework.beans.test.fixtures.beans.Colour
|
||||
import org.springframework.beans.test.fixtures.beans.TestBean
|
||||
|
||||
/**
|
||||
* Tests for Kotlin support with [Autowired].
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="test3" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<bean id="test3" class="org.springframework.beans.test.fixtures.beans.TestBean" scope="prototype">
|
||||
<property name="name"><value>custom</value></property>
|
||||
<property name="age"><value>25</value></property>
|
||||
</bean>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<beans>
|
||||
|
||||
<!-- Simple target -->
|
||||
<bean id="test" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="test" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="name"><value>custom</value></property>
|
||||
<property name="age"><value>666</value></property>
|
||||
</bean>
|
||||
@@ -13,7 +13,7 @@
|
||||
Check that invoker is automatically added to wrap target.
|
||||
Non pointcut bean name should be wrapped in invoker.
|
||||
-->
|
||||
<bean id="numberTestBean" class="org.springframework.tests.sample.beans.NumberTestBean"/>
|
||||
<bean id="numberTestBean" class="org.springframework.beans.test.fixtures.beans.NumberTestBean"/>
|
||||
|
||||
</beans>
|
||||
|
||||
|
||||
@@ -6,21 +6,21 @@
|
||||
<!--
|
||||
Just included for the count: not to mean anything in particular
|
||||
-->
|
||||
<bean id="something" class="org.springframework.tests.sample.beans.GenericIntegerBean"/>
|
||||
<bean id="something" class="org.springframework.beans.test.fixtures.beans.GenericIntegerBean"/>
|
||||
|
||||
<bean id="indexedBean" class="org.springframework.tests.sample.beans.IndexedTestBean"/>
|
||||
<bean id="indexedBean" class="org.springframework.beans.test.fixtures.beans.IndexedTestBean"/>
|
||||
|
||||
<bean id="annotatedBean" class="org.springframework.tests.sample.beans.AnnotatedBean"/>
|
||||
<bean id="annotatedBean" class="org.springframework.beans.test.fixtures.beans.AnnotatedBean"/>
|
||||
|
||||
<!-- Overridden by next factory -->
|
||||
<bean id="test" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="test" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="name"><value>custom</value></property>
|
||||
<property name="age"><value>25</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="testFactory1" class="org.springframework.tests.sample.beans.factory.DummyFactory"/>
|
||||
<bean id="testFactory1" class="org.springframework.beans.test.fixtures.beans.factory.DummyFactory"/>
|
||||
|
||||
<bean id="testFactory2" class="org.springframework.tests.sample.beans.factory.DummyFactory">
|
||||
<bean id="testFactory2" class="org.springframework.beans.test.fixtures.beans.factory.DummyFactory">
|
||||
<property name="singleton"><value>false</value></property>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="someIntegerArray">
|
||||
<list>
|
||||
<bean name="java.sql.Connection.TRANSACTION_SERIALIZABLE" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="tb" class="org.springframework.tests.sample.beans.TestBean" scope="prototype">
|
||||
<bean id="tb" class="org.springframework.beans.test.fixtures.beans.TestBean" scope="prototype">
|
||||
<property name="age"><value>10</value></property>
|
||||
<property name="spouse">
|
||||
<bean class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="age"><value>11</value></property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="otb" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="otb" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="age"><value>98</value></property>
|
||||
<property name="spouse">
|
||||
<bean class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="age"><value>99</value></property>
|
||||
</bean>
|
||||
</property>
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<bean id="propertyPath1" class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
|
||||
<property name="targetObject">
|
||||
<bean class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="age"><value>12</value></property>
|
||||
</bean>
|
||||
</property>
|
||||
@@ -46,10 +46,10 @@
|
||||
<bean id="propertyPath3" class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
|
||||
<property name="targetBeanName"><value>tb</value></property>
|
||||
<property name="propertyPath"><value>spouse</value></property>
|
||||
<property name="resultType"><value>org.springframework.tests.sample.beans.TestBean</value></property>
|
||||
<property name="resultType"><value>org.springframework.beans.test.fixtures.beans.TestBean</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="tbWithInner" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="tbWithInner" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="age" value="10"/>
|
||||
<property name="spouse">
|
||||
<bean name="otb.spouse" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>
|
||||
@@ -59,11 +59,11 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="tbWithNullReference" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="tbWithNullReference" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="spouse" ref="tb.spouse.spouse"/>
|
||||
</bean>
|
||||
|
||||
<bean id="tbWithInnerNull" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="tbWithInnerNull" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="spouse">
|
||||
<bean name="tb.spouse.spouse" class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>
|
||||
</property>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<bean id="usesScope" class="org.springframework.tests.sample.beans.TestBean" scope="myScope"/>
|
||||
<bean id="usesScope" class="org.springframework.beans.test.fixtures.beans.TestBean" scope="myScope"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<bean id="invalidClass" class="some.class.that.does.not.Exist"/>
|
||||
|
||||
<bean id="invalidMapDefinition" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="invalidMapDefinition" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="someMap">
|
||||
<map>
|
||||
<entry/>
|
||||
@@ -14,9 +14,9 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="nestedBeanErrors" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="nestedBeanErrors" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="spouse">
|
||||
<bean class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="someMap">
|
||||
<map>
|
||||
<entry/>
|
||||
@@ -26,5 +26,6 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="validBean" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
<bean id="validBean" class="org.springframework.beans.test.fixtures.beans.TestBean"/>
|
||||
|
||||
</beans>
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="listOfArrays" class="org.springframework.tests.sample.beans.GenericBean">
|
||||
<bean id="listOfArrays" class="org.springframework.beans.test.fixtures.beans.GenericBean">
|
||||
<property name="listOfArrays">
|
||||
<list>
|
||||
<list>
|
||||
@@ -43,7 +43,7 @@
|
||||
autowire="constructor">
|
||||
</bean>
|
||||
|
||||
<bean id="integerBean" class="org.springframework.tests.sample.beans.GenericIntegerBean">
|
||||
<bean id="integerBean" class="org.springframework.beans.test.fixtures.beans.GenericIntegerBean">
|
||||
<property name="genericProperty" value="10"/>
|
||||
<property name="genericListProperty">
|
||||
<list>
|
||||
@@ -53,7 +53,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="setOfIntegerBean" class="org.springframework.tests.sample.beans.GenericSetOfIntegerBean">
|
||||
<bean id="setOfIntegerBean" class="org.springframework.beans.test.fixtures.beans.GenericSetOfIntegerBean">
|
||||
<property name="genericProperty" value="10"/>
|
||||
<property name="genericListProperty">
|
||||
<list>
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
<lookup-method name="getOneArgument" bean="jedi"/>
|
||||
</bean>
|
||||
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean" scope="prototype"/>
|
||||
<bean id="testBean" class="org.springframework.beans.test.fixtures.beans.TestBean" scope="prototype"/>
|
||||
|
||||
<bean id="jedi" class="org.springframework.tests.sample.beans.TestBean" scope="prototype" autowire-candidate="false">
|
||||
<bean id="jedi" class="org.springframework.beans.test.fixtures.beans.TestBean" scope="prototype" autowire-candidate="false">
|
||||
<property name="jedi" value="true"/>
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
testBean.(class)=org.springframework.tests.sample.beans.TestBean
|
||||
testBean.(class)=org.springframework.beans.test.fixtures.beans.TestBean
|
||||
testBean.$0=Rob Harrop
|
||||
testBean.$1=23
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
sally.(class)=org.springframework.tests.sample.beans.TestBean
|
||||
sally.(class)=org.springframework.beans.test.fixtures.beans.TestBean
|
||||
sally.name=Sally
|
||||
|
||||
rob.(class)=org.springframework.tests.sample.beans.TestBean
|
||||
rob.(class)=org.springframework.beans.test.fixtures.beans.TestBean
|
||||
rob.$0(ref)=sally
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
testBean.(class)=org.springframework.tests.sample.beans.TestBean
|
||||
testBean.(class)=org.springframework.beans.test.fixtures.beans.TestBean
|
||||
testBean.$0=Rob Harrop
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="name" value="topLevel"/>
|
||||
</bean>
|
||||
|
||||
<beans>
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="name" value="nested"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="name" value="original"/>
|
||||
</bean>
|
||||
|
||||
<!-- STS should raise an error for this duplicate id -->
|
||||
<bean id="testBean" class="org.springframework.tests.sample.beans.TestBean">
|
||||
<bean id="testBean" class="org.springframework.beans.test.fixtures.beans.TestBean">
|
||||
<property name="name" value="duplicate"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
https://www.springframework.org/schema/beans/spring-beans-3.1.xsd"
|
||||
default-merge="false">
|
||||
|
||||
<bean id="abstractTestBean" class="org.springframework.tests.sample.beans.TestBean" abstract="true">
|
||||
<bean id="abstractTestBean" class="org.springframework.beans.test.fixtures.beans.TestBean" abstract="true">
|
||||
<property name="someList">
|
||||
<list>
|
||||
<value>alpha</value>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="rob" class="org.springframework.tests.sample.beans.TestBean" scope="prototype" autowire="constructor"/>
|
||||
<bean id="rob" class="org.springframework.beans.test.fixtures.beans.TestBean" scope="prototype" autowire="constructor"/>
|
||||
|
||||
<bean id="sally" class="org.springframework.tests.sample.beans.TestBean" scope="prototype"/>
|
||||
<bean id="sally" class="org.springframework.beans.test.fixtures.beans.TestBean" scope="prototype"/>
|
||||
|
||||
<bean id="props1" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||
<property name="properties">
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="rob" class="org.springframework.tests.sample.beans.TestBean" autowire="byType"/>
|
||||
<bean id="rob" class="org.springframework.beans.test.fixtures.beans.TestBean" autowire="byType"/>
|
||||
|
||||
<bean id="sally" class="org.springframework.tests.sample.beans.TestBean"/>
|
||||
<bean id="sally" class="org.springframework.beans.test.fixtures.beans.TestBean"/>
|
||||
|
||||
<bean id="props1" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||
<property name="properties">
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user