Skip to content

Instantly share code, notes, and snippets.

@bvulaj
Last active March 14, 2018 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvulaj/43b80f72e51f2ceb874faffddd969209 to your computer and use it in GitHub Desktop.
Save bvulaj/43b80f72e51f2ceb874faffddd969209 to your computer and use it in GitHub Desktop.
Configuring Multiple Objects of the Same Type
@Configuration
public class AppConfig {
@Bean
@ConfigurationProperties("foo")
public ProviderInfo fooProviderInfo() {
return new ProviderInfo();
}
@Bean
@ConfigurationProperties("bar")
public ProviderInfo barProviderInfo() {
return new ProviderInfo();
}
}
foo.name=foo
bar.name=bar
public class ProviderInfo {
private String name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment