Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Various fixes/improvements #5

Merged
merged 12 commits into from about 2 years ago

1 participant

Martin Ellis
Martin Ellis
Collaborator

Support for nested beans that declare a parent bean

5224d30 Fix merge problem from pull request 4.
e425eb8 Rename XML files used in autowire tests, and group them in a directory.
2dedbc4 Remove unused test resource in maven plugin.
f675056 Add ConfigurationBuilder to wire SpringConfigurationLoader and augmentations.
33924b7 Merge nested bean definitions with their parent bean definitions.

The current support for parent beans only allows top-level beans to declare a parent bean.

This changeset adds support for a nested bean with a bean.

Example:

    <bean id="parent"
          class="me.springframework.di.spring.NestedBeanTest$Bean"
          abstract="true">
      <property name="name"><value>Martin</value></property>          
    </bean>

    <bean id="holder"
          class="me.springframework.di.spring.NestedBeanTest$Holder">
      <property name="bean">
        <bean parent="parent">
          <property name="number"><value>1</value></property>
        </bean>
      </property>
    </bean>

Array support

I've added support for injecting list values into array properties. Spring will automatically copy the list into an array, so I've updated the template to do this too.

8df57dd Extend BeanFactoryType to provide method name used to copy a list into an array.
e25c3dd Make EntrySink and ElementSink sub-classes of AbstractSink to reduce code duplication.
84fea80 Fix inferred type of array properties.
e320656 Copy list elements into an array when injecting array properties.

Resource support

38428ef Support for Resource properties. (Useful for Java SE only)

Bug fix

73d40a1 Add missing semi-colon on statements that add elements to a set.

Support for indexed constructor arguments

ccefe91 Add support for indexed constructor arguments.

martiell and others added some commits
Martin Ellis martiell Rename XML files used in autowire tests, and group them in a directory.
The renamed XML files have names that suggest the purpose of the test,
rather than being numbered sequentially.
e425eb8
Martin Ellis martiell Remove unused test resource in maven plugin. 2dedbc4
Martin Ellis martiell Fix merge problem from pull request 4.
The following commit from pull request 4 was not merged properly:
dd3b30a	Add support for ManagedProperties to Java SE targets.
Instead, 965afa2 was merged, which had a failing test.
5224d30
Martin Ellis martiell Add ConfigurationBuilder to wire SpringConfigurationLoader and augmen…
…tations.

This adds a ConfigurationBuilder class to simplify creating a
SpringConfigurationLoader configured with the necessary augmentations.
The ConfigurationBuilder supports ApplicationContext objects in
addition to BeanFactory objects.

This change also adds the BeanFactory as an instance variable of
SpringConfigurationLoader. The BeanFactory is required for retrieving
information about each bean. Previously, it was only available for
top-level beans. By storing the BeanFactory as an instance variable,
it is now available for obtaining the BeanDefinition of nested beans.
f675056
Martin Ellis martiell Merge nested bean definitions with their parent bean definitions.
Previously, only top-level beans were merged with parent definitions.
The Spring getMergedBeanDefinition method cannot be used for bean
definitions that are not at the top-level, because the BeanFactory does
not recognise the name of the nested bean.

This change includes a simple algorithm for merging nested beans with
their parents, because the methods required to merge BeanDefinitions
in the BeanFactory are protected methods.
33924b7
Martin Ellis martiell Extend BeanFactoryType to provide method name used to copy a list int…
…o an array.
8df57dd
Martin Ellis martiell Make EntrySink and ElementSink sub-classes of AbstractSink to reduce …
…code duplication.
e25c3dd
Martin Ellis martiell Fix inferred type of array properties.
The getValue() method on the QDox Type class returns the element type
as a string for array types. The code was using getValue() without
checking whether the type was an array type. The toString() method
returns the type name with array brackets for each array dimension,
which provides the type in the required format.
84fea80
Martin Ellis martiell Copy list elements into an array when injecting array properties. e320656
Martin Ellis martiell Support for Resource properties. 38428ef
Martin Ellis martiell Add missing semi-colon on statements that add elements to a set. 73d40a1
Martin Ellis martiell Add support for indexed constructor arguments. ccefe91
Martin Ellis martiell merged commit db14f1a into from
Martin Ellis martiell closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 12 unique commits by 2 authors.

Mar 20, 2012
Martin Ellis martiell Rename XML files used in autowire tests, and group them in a directory.
The renamed XML files have names that suggest the purpose of the test,
rather than being numbered sequentially.
e425eb8
Martin Ellis martiell Remove unused test resource in maven plugin. 2dedbc4
Martin Ellis martiell Fix merge problem from pull request 4.
The following commit from pull request 4 was not merged properly:
dd3b30a	Add support for ManagedProperties to Java SE targets.
Instead, 965afa2 was merged, which had a failing test.
5224d30
Mar 26, 2012
Martin Ellis martiell Add ConfigurationBuilder to wire SpringConfigurationLoader and augmen…
…tations.

This adds a ConfigurationBuilder class to simplify creating a
SpringConfigurationLoader configured with the necessary augmentations.
The ConfigurationBuilder supports ApplicationContext objects in
addition to BeanFactory objects.

This change also adds the BeanFactory as an instance variable of
SpringConfigurationLoader. The BeanFactory is required for retrieving
information about each bean. Previously, it was only available for
top-level beans. By storing the BeanFactory as an instance variable,
it is now available for obtaining the BeanDefinition of nested beans.
f675056
Martin Ellis martiell Merge nested bean definitions with their parent bean definitions.
Previously, only top-level beans were merged with parent definitions.
The Spring getMergedBeanDefinition method cannot be used for bean
definitions that are not at the top-level, because the BeanFactory does
not recognise the name of the nested bean.

This change includes a simple algorithm for merging nested beans with
their parents, because the methods required to merge BeanDefinitions
in the BeanFactory are protected methods.
33924b7
Mar 30, 2012
Martin Ellis martiell Extend BeanFactoryType to provide method name used to copy a list int…
…o an array.
8df57dd
Martin Ellis martiell Make EntrySink and ElementSink sub-classes of AbstractSink to reduce …
…code duplication.
e25c3dd
Martin Ellis martiell Fix inferred type of array properties.
The getValue() method on the QDox Type class returns the element type
as a string for array types. The code was using getValue() without
checking whether the type was an array type. The toString() method
returns the type name with array brackets for each array dimension,
which provides the type in the required format.
84fea80
Martin Ellis martiell Copy list elements into an array when injecting array properties. e320656
Apr 04, 2012
Martin Ellis martiell Support for Resource properties. 38428ef
Martin Ellis martiell Add missing semi-colon on statements that add elements to a set. 73d40a1
Apr 24, 2012
Martin Ellis martiell Add support for indexed constructor arguments. ccefe91
Something went wrong with that request. Please try again.