Created
February 21, 2012 11:10
-
-
Save gonzalad/1875898 to your computer and use it in GitHub Desktop.
Seam 3 Theme Configuration
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
@Singleton | |
@Startup | |
public class MyAppStartupConfig { | |
@Inject | |
private ThemeSelector themeSelector; | |
@PostConstruct | |
public void onLoad() { | |
themeSelector.setAvailableThemes(new String[]{"blue", "red", "black"}); | |
} | |
} |
What I want to do is to :
- have Theme class which will contain all configuration values.
Theme will be renamed ThemeConfig - ThemeConfig will be injected in ThemeSelector which reads all ThemeConfig values.
So, my EJB3 code will change with :
@singleton
@startup
public class MyAppStartupConfig {
@Inject
private ThemeConfig themeConfig;
@PostConstruct
public void onLoad() {
themeConfig.setAvailableThemes(new String[]{"blue", "red", "black"});
}
}
And this will work
But perhaps there's a better solution... donno
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is due to the fact that themeSelector is sessionScoped