Skip to content

Instantly share code, notes, and snippets.

@eeichinger
Created April 8, 2014 14:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save eeichinger/10131204 to your computer and use it in GitHub Desktop.
My favorite "use spring to instantiate but register as a static global singleton" solution
@Service("blActivityStateManager")
public class ActivityStateManagerImpl implements ActivityStateManager {
private static ActivityStateManager ACTIVITY_STATE_MANAGER;
public static ActivityStateManager getStateManager() {
return ACTIVITY_STATE_MANAGER;
}
@PostConstruct
public void init() {
ACTIVITY_STATE_MANAGER = this;
}
....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment