Advertisement
Guest User

Chris Beams

a guest
May 1st, 2009
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <beans>
  2. <context:annotation-config/>
  3. <bean class="com.foo.AppConfig"/>
  4. </beans>
  5.  
  6. Where 'AppConfig' is a @Configuration class:
  7.  
  8. @Configuration
  9. public class AppConfig {
  10. public @Bean Foo foo() {
  11. return new Foo();
  12. }
  13. }
  14.  
  15. The application would then be bootstrapped as follows:
  16.  
  17. ApplicationContext context = new ClassPathApplicationContext("app-config.xml");
  18. Foo foo = context.getBean("foo", Foo.class);
  19.  
  20. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement