Skip to content

Instantly share code, notes, and snippets.

@tag1216
Created December 17, 2014 05:49
Show Gist options
  • Save tag1216/4591d421802861c37dd5 to your computer and use it in GitHub Desktop.
Save tag1216/4591d421802861c37dd5 to your computer and use it in GitHub Desktop.
SpringでいつでもどこでもApplicationContextを取得する
@Component
public class ApplicationContextProvider implements ApplicationContextAware {
private static ApplicationContext context;
public static ApplicationContext getApplicationContext() {
return context;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
context = applicationContext;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment