Created
April 19, 2011 15:15
-
-
Save cbeams/928339 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@Import(MyFrameworkConfiguration.class) | |
public class UserConfig implements MyFrameworkInitializer { | |
@Bean | |
public FooCallback fooCallback() { | |
return new FooCallback() { | |
public void doWithFoo(Foo foo) { | |
foo.setAwesome(true); | |
} | |
}; | |
} | |
} | |
public interface MyFrameworkInitializer { | |
FooCallback fooCallback(); | |
} | |
@Configuration | |
public class MyFrameworkConfiguration { | |
@Autowired(optional=true) | |
private FooCallback fooCallback; | |
@PostConstruct | |
public void initialize() { | |
if (fooCallback != null) { | |
fooCallback.doWithFoo(foo()); | |
} | |
} | |
@Bean | |
public Foo foo() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment