Skip to content

Instantly share code, notes, and snippets.

@eeichinger
Created April 8, 2014 14:17
Show Gist options
  • Save eeichinger/10131204 to your computer and use it in GitHub Desktop.
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