Skip to content

Instantly share code, notes, and snippets.

@hertzsprung
Created November 8, 2012 17:00
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 hertzsprung/4040071 to your computer and use it in GitHub Desktop.
Save hertzsprung/4040071 to your computer and use it in GitHub Desktop.
Spring Java configuration
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes=BeanTest.Config.class)
public class BeanTest {
@Test
public void test() {}
@Configuration
public static class Config {
@Bean public Object bean1() {
System.out.println(bean2());
System.out.println(bean2());
return new Object();
}
@Bean public Object bean2() {
return new Object();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment