Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load properties for @ConfigurationSource on @Provides methods #575

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

elandau
Copy link
Contributor

@elandau elandau commented Jun 27, 2019

Loading configuration with @provides methods currently requires a hack to inject a second type that is annotated with @ConfigurationSource. This change makes it possible to annotate the @provides method with @ConfigurationSource to have the configuration loaded before the bean is provisioned. For example,

@ConfigurationSource({"foo"})
@Provides
@Singleton
Foo getFoo() {
}

will result in foo.properties (and it's variants) being loaded before getFoo is called.

Loading configuration with @provides methods currently requires a hack to inject a second type that is annotated with @ConfigurationSource.  This change makes it possible to annotate the @provides with with @ConfigurationSource to have the configuration loaded before the bean is provisioned.  For example,

```
@ConfigurationSource({"foo"})
@provides
@singleton
Foo getFoo() {
}
```
will result in foo.properties (and it's variants) being loaded before getFoo is called.
@elandau elandau force-pushed the feature/at_provides_configuration_source branch from ef7444e to b923dcd Compare June 27, 2019 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants