Java tutorial
/******************************************************************************* * logsniffer, open source tool for viewing, monitoring and analysing log data. * Copyright (c) 2015 Scaleborn UG, www.scaleborn.com * * logsniffer is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * logsniffer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ package com.logsniffer.app; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; /** * Singleton for accessing the app context. * * @author mbok * */ public class ContextProvider implements ApplicationContextAware { private static ApplicationContext context; public static final String PROFILE_NONE_QA = "NONE_QA"; /** * @return the context */ public static ApplicationContext getContext() { return context; } /** * @param context * the context to set */ public static void setContext(ApplicationContext context) { ContextProvider.context = context; } @Override public void setApplicationContext(ApplicationContext context) throws BeansException { setContext(context); } }