Skip to content

Instantly share code, notes, and snippets.

@gonzalad
Created February 21, 2012 11:10
Show Gist options
  • Save gonzalad/1875898 to your computer and use it in GitHub Desktop.
Save gonzalad/1875898 to your computer and use it in GitHub Desktop.
Seam 3 Theme Configuration
@Singleton
@Startup
public class MyAppStartupConfig {
@Inject
private ThemeSelector themeSelector;
@PostConstruct
public void onLoad() {
themeSelector.setAvailableThemes(new String[]{"blue", "red", "black"});
}
}
@gonzalad
Copy link
Author

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

@gonzalad
Copy link
Author

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