Skip to content

Instantly share code, notes, and snippets.

@martyychang
Created April 22, 2016 20:22
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 martyychang/d7ecae6605aeb6510512893354ad6ec5 to your computer and use it in GitHub Desktop.
Save martyychang/d7ecae6605aeb6510512893354ad6ec5 to your computer and use it in GitHub Desktop.
@Configuration
public class AppConfig {
public @Bean Foo fooer() {
return new Foo("fooer");
}
public @Bean Foo fooey() {
return new Foo("fooey");
}
}
public class Foo {
private String name;
public Foo(String name) {
this.name = name;
}
}
@Component
public class FooerBar {
/**
* This gets injected with the fooer bean
*/
@Autowired
private Foo fooer;
...
}
@Component
public class FooeyBar {
/**
* This gets injected with the fooey bean
*/
@Autowired
private Foo fooey;
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment