Created
April 19, 2011 15:39
-
-
Save cbeams/928503 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 { | |
protected void setMyFrameworkInitializer(MyFrameworkInitializer initializer) { | |
super.setMyFrameworkInitializer(this) | |
} | |
public void configureFoo(Foo foo) { | |
foo.setAwesome(true); | |
} | |
} | |
public interface MyFrameworkInitializer { | |
void configureFoo(Foo foo); | |
} | |
@Configuration | |
public class MyFrameworkConfiguration { | |
private MyFrameworkInitializer initializer; | |
@Autowired(optional=true) | |
protected void setMyFrameworkInitializer(MyFrameworkInitializer initializer) { | |
this.initializer = initializer; | |
} | |
@PostConstruct | |
public void initialize() { | |
if (initializer != null) { | |
initializer.configureFoo(foo()); | |
} | |
} | |
@Bean | |
public Foo foo() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment