diff --git a/org.springframework.config.java/.settings/org.springframework.ide.eclipse.beans.core.prefs b/org.springframework.config.java/.settings/org.springframework.ide.eclipse.beans.core.prefs new file mode 100644 index 0000000000..ae843feb75 --- /dev/null +++ b/org.springframework.config.java/.settings/org.springframework.ide.eclipse.beans.core.prefs @@ -0,0 +1,3 @@ +#Fri Feb 27 19:22:36 PST 2009 +eclipse.preferences.version=1 +org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false diff --git a/org.springframework.config.java/.springBeans b/org.springframework.config.java/.springBeans index a0a0dbf99e..b8ae900a11 100644 --- a/org.springframework.config.java/.springBeans +++ b/org.springframework.config.java/.springBeans @@ -8,6 +8,7 @@ src/test/java/test/basic/AutowiredConfigurationTests.xml + src/test/java/test/basic/ValueInjectionTests.xml diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/factory/support/ConfigurationClassBeanDefinitionReader.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/factory/support/ConfigurationClassBeanDefinitionReader.java deleted file mode 100644 index b4ccfac414..0000000000 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/factory/support/ConfigurationClassBeanDefinitionReader.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2002-2008 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 - * - * http://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.config.java.internal.factory.support; - -import java.util.ArrayList; -import java.util.Map; - -import org.springframework.beans.factory.BeanDefinitionStoreException; -import org.springframework.beans.factory.support.BeanDefinitionReader; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.config.java.Configuration; -import org.springframework.config.java.ConfigurationModel; -import org.springframework.config.java.MalformedJavaConfigurationException; -import org.springframework.config.java.UsageError; -import org.springframework.config.java.internal.parsing.ConfigurationParser; -import org.springframework.core.io.ClassPathResource; - - -/** - * Uses ASM to parse {@link Configuration @Configuration} classes. Fashioned after the - * {@link BeanDefinitionReader} hierarchy, but does not extend or implement any of its - * types because differences were significant enough to merit the departure. - * - * @see AsmConfigurationParser - * - * @author Chris Beams - */ -public class ConfigurationClassBeanDefinitionReader { - - private final ConfigurationModelBeanDefinitionReader modelBeanDefinitionReader; - - /** - * Creates a new {@link ConfigurationClassBeanDefinitionReader}. - * - * @param beanFactory {@link DefaultListableBeanFactory} into which new bean definitions will be - * registered as they are read from Configuration classes. - */ - public ConfigurationClassBeanDefinitionReader(DefaultListableBeanFactory beanFactory) { - this.modelBeanDefinitionReader = new ConfigurationModelBeanDefinitionReader(beanFactory); - } - - /** - * Parses each {@link Configuration} class specified by configClassResources and registers - * individual bean definitions from those Configuration classes into the BeanDefinitionRegistry - * supplied during construction. - */ - public int loadBeanDefinitions(ConfigurationModel model, Map configClassResources) throws BeanDefinitionStoreException { - ConfigurationParser parser = new ConfigurationParser(model); - - for (String id : configClassResources.keySet()) - parser.parse(configClassResources.get(id), id); - - ArrayList errors = new ArrayList(); - model.validate(errors); - if (errors.size() > 0) - throw new MalformedJavaConfigurationException(errors.toArray(new UsageError[] { })); - - return modelBeanDefinitionReader.loadBeanDefinitions(model); - } - -} diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/AsmUtils.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/AsmUtils.java index 70d62f07b8..47929253b1 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/AsmUtils.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/AsmUtils.java @@ -28,7 +28,7 @@ import org.springframework.config.java.Util; /** * Various utility methods commonly used when interacting with ASM. */ -public class AsmUtils { +class AsmUtils { public static final EmptyVisitor EMPTY_VISITOR = new EmptyVisitor(); diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/ConfigurationParser.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/ConfigurationParser.java index 2d7db11d42..7be482d4b9 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/ConfigurationParser.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/ConfigurationParser.java @@ -36,7 +36,7 @@ import org.springframework.core.io.ClassPathResource; * that model. * * @see org.springframework.config.java.ConfigurationModel - * @see org.springframework.config.java.internal.factory.support.ConfigurationModelBeanDefinitionReader + * @see org.springframework.config.java.support.ConfigurationModelBeanDefinitionReader * * @author Chris Beams */ diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/MutableAnnotationUtils.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/MutableAnnotationUtils.java index e4c1fbadd0..cd50f4f683 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/MutableAnnotationUtils.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/parsing/MutableAnnotationUtils.java @@ -20,8 +20,7 @@ import java.lang.reflect.Proxy; /** TODO: JAVADOC */ -// TODO: SJC-242 made this public, revisit -public class MutableAnnotationUtils { +class MutableAnnotationUtils { /** * Creates a {@link MutableAnnotation} for {@code annoType}. diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/process/ConfigurationPostProcessor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/process/ConfigurationPostProcessor.java deleted file mode 100644 index f0ee1d88d0..0000000000 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/process/ConfigurationPostProcessor.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2002-2008 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 - * - * http://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.config.java.process; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.config.java.Configuration; -import org.springframework.config.java.internal.process.InternalConfigurationPostProcessor; -import org.springframework.core.Ordered; - - -/** - * {@link BeanFactoryPostProcessor} used for bootstrapping {@link Configuration @Configuration} - * beans from Spring XML files. - */ -// TODO: This class now just delegates to InternalConfigurationPostProcessor. Eliminate? -public class ConfigurationPostProcessor implements Ordered, BeanFactoryPostProcessor { - - /** - * Iterates through beanFactory, detecting and processing any {@link Configuration} - * bean definitions. - */ - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - new InternalConfigurationPostProcessor().postProcessBeanFactory(beanFactory); - } - - /** - * Returns the order in which this {@link BeanPostProcessor} will be executed. - * Returns {@link Ordered#HIGHEST_PRECEDENCE}. - */ - public int getOrder() { - return Ordered.HIGHEST_PRECEDENCE; - } - -} diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/factory/support/ConfigurationModelBeanDefinitionReader.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModelBeanDefinitionReader.java similarity index 98% rename from org.springframework.config.java/src/main/java/org/springframework/config/java/internal/factory/support/ConfigurationModelBeanDefinitionReader.java rename to org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModelBeanDefinitionReader.java index f79e4447f5..e59b9d4b4f 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/factory/support/ConfigurationModelBeanDefinitionReader.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationModelBeanDefinitionReader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.config.java.internal.factory.support; +package org.springframework.config.java.support; import static java.lang.String.*; @@ -55,8 +55,7 @@ import org.springframework.util.Assert; * * @author Chris Beams */ -// TODO: Unit test -public class ConfigurationModelBeanDefinitionReader { +class ConfigurationModelBeanDefinitionReader { private static final Log log = LogFactory.getLog(ConfigurationModelBeanDefinitionReader.class); diff --git a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/process/InternalConfigurationPostProcessor.java b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationPostProcessor.java similarity index 88% rename from org.springframework.config.java/src/main/java/org/springframework/config/java/internal/process/InternalConfigurationPostProcessor.java rename to org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationPostProcessor.java index cfe4500c01..921444d4a7 100644 --- a/org.springframework.config.java/src/main/java/org/springframework/config/java/internal/process/InternalConfigurationPostProcessor.java +++ b/org.springframework.config.java/src/main/java/org/springframework/config/java/support/ConfigurationPostProcessor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.config.java.internal.process; +package org.springframework.config.java.support; import static org.springframework.config.java.Util.*; @@ -33,18 +33,29 @@ import org.springframework.config.java.ConfigurationModel; import org.springframework.config.java.MalformedJavaConfigurationException; import org.springframework.config.java.UsageError; import org.springframework.config.java.internal.enhancement.ConfigurationEnhancer; -import org.springframework.config.java.internal.factory.support.ConfigurationClassBeanDefinitionReader; -import org.springframework.config.java.internal.factory.support.ConfigurationModelBeanDefinitionReader; import org.springframework.config.java.internal.parsing.ConfigurationParser; -import org.springframework.config.java.process.ConfigurationPostProcessor; +import org.springframework.core.Ordered; import org.springframework.core.io.ClassPathResource; import org.springframework.util.ClassUtils; -/** TODO: JAVADOC */ -public class InternalConfigurationPostProcessor implements BeanFactoryPostProcessor { +/** + * {@link BeanFactoryPostProcessor} used for bootstrapping {@link Configuration @Configuration} + * beans from Spring XML files. + */ +public class ConfigurationPostProcessor implements Ordered, BeanFactoryPostProcessor { + + private static final Log logger = LogFactory.getLog(ConfigurationPostProcessor.class); + + + /** + * Returns the order in which this {@link BeanPostProcessor} will be executed. + * Returns {@link Ordered#HIGHEST_PRECEDENCE}. + */ + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } - private static final Log logger = LogFactory.getLog(InternalConfigurationPostProcessor.class); /** * Searches beanFactory for any {@link Configuration} classes in order @@ -141,8 +152,8 @@ public class InternalConfigurationPostProcessor implements BeanFactoryPostProces * Note: the classloading used within should not be problematic or interfere with tooling in any * way. BeanFactoryPostProcessing happens only during actual runtime processing via * {@link JavaConfigApplicationContext} or via XML using {@link ConfigurationPostProcessor}. In - * any case, tooling (Spring IDE) will use {@link ConfigurationClassBeanDefinitionReader}directly, - * thus never encountering this classloading. Should this become problematic, it would not be + * any case, tooling (Spring IDE) will hook in at a lower level than this class and + * thus never encounter this classloading. Should this become problematic, it would not be * too difficult to replace the following with ASM logic that traverses the class hierarchy in * order to find whether the class is directly or indirectly annotated with * {@link Configuration}. diff --git a/org.springframework.config.java/src/test/java/test/basic/AutowiredConfigurationTests.xml b/org.springframework.config.java/src/test/java/test/basic/AutowiredConfigurationTests.xml index 88327c8fc8..124dee31a3 100644 --- a/org.springframework.config.java/src/test/java/test/basic/AutowiredConfigurationTests.xml +++ b/org.springframework.config.java/src/test/java/test/basic/AutowiredConfigurationTests.xml @@ -7,7 +7,7 @@ - + diff --git a/org.springframework.config.java/src/test/java/test/basic/BasicTests.java b/org.springframework.config.java/src/test/java/test/basic/BasicTests.java index a1927f14f0..60b6157a89 100644 --- a/org.springframework.config.java/src/test/java/test/basic/BasicTests.java +++ b/org.springframework.config.java/src/test/java/test/basic/BasicTests.java @@ -11,7 +11,7 @@ import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.config.java.Configuration; import org.springframework.config.java.ext.Bean; -import org.springframework.config.java.process.ConfigurationPostProcessor; +import org.springframework.config.java.support.ConfigurationPostProcessor; import org.springframework.config.java.util.DefaultScopes; import test.beans.ITestBean; diff --git a/org.springframework.config.java/src/test/java/test/basic/ValueInjectionTests.xml b/org.springframework.config.java/src/test/java/test/basic/ValueInjectionTests.xml index 78f8a6a7de..a2e1988906 100644 --- a/org.springframework.config.java/src/test/java/test/basic/ValueInjectionTests.xml +++ b/org.springframework.config.java/src/test/java/test/basic/ValueInjectionTests.xml @@ -7,7 +7,7 @@ - +