Skip to content

Fix configuration class overriden/overloaded methods issues (SPR-10992, SPR-10988) - #398

Closed
chelu wants to merge 1 commit into
spring-projects:masterfrom
chelu:SPR-10988
Closed

chelu wants to merge 1 commit into
spring-projects:masterfrom
chelu:SPR-10988

Conversation

@chelu

@chelu chelu commented Oct 30, 2013

Copy link
Copy Markdown

When adding bean methods from a configuration class,
overridden methods from superclass are added too and
it's bean definition overrides those declared in the subclass.

The fix add a new method, getBeanMethodsToDefine that filter
overriden methods for use in ConfigurationClassBeanDefinitionReader

When overloading methods from a configuration class, the most
specific subclass bean method is invoked only if

  • Argument types has the best match
  • Overloaded method in subclass has the same number of arguments.

The fix sets the factory method to use from beanMethod metadata to
RootBeanDefinition.resolvedConstructorOrFactoryMethod in
ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod()
to avoid looking for appropiate factory method in ConstructorResolver later.

This pull request already includes changes from #390

Issues: SPR-10992, SPR-10988

When adding bean methods from a configuration class,
overridden methods from superclass are added too and
it's bean definition overrides those declared in the subclass.

The fix add a new method, getBeanMethodsToDefine that filter
overriden methods for use in ConfigurationClassBeanDefinitionReader

When overloading methods from a configuration class, the most
specific subclass bean method is invoked only if

- Argument types has the best match
- Overloaded method in subclass has the same number of arguments.

The fix sets the factory method to use from beanMethod metadata to
RootBeanDefinition.resolvedConstructorOrFactoryMethod in
ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod()
to avoid looking for appropiate factory method in ConstructorResolver.

Issues: SPR-10992, SPR-10988
@chelu chelu closed this Nov 4, 2013
@chelu

chelu commented Nov 4, 2013

Copy link
Copy Markdown
Author

Closed as both issues are now resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant