本文整理汇总了Java中org.springframework.context.access.ContextSingletonBeanFactoryLocator类的典型用法代码示例。如果您正苦于以下问题:Java ContextSingletonBeanFactoryLocator类的具体用法?Java ContextSingletonBeanFactoryLocator怎么用?Java ContextSingletonBeanFactoryLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextSingletonBeanFactoryLocator类属于org.springframework.context.access包,在下文中一共展示了ContextSingletonBeanFactoryLocator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
/**
* Lookup and launch the timer.
*
* @param config servlet configuration
* @throws ServletException shouldn't occur
*
* @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
String jndiName = config.getInitParameter(JNDI_NAME);
if ((jndiName == null) || "".equals(jndiName)) {
LOG.error("Please specify a '" + JNDI_NAME + "' parameter to lookup the timer manager.");
return;
}
try {
TimerFactory.instance().setManager((TimerManager) (new InitialContext()).lookup(jndiName));
// launch timer indirectly
Configuration datupConfig = (Configuration) ContextSingletonBeanFactoryLocator.getInstance(
"classpath*:beanRefContext.xml").useBeanFactory("businessBeanFactory").getFactory().getBean(
"datupConfiguration");
LOG.debug(datupConfig);
}
catch (Throwable t) {
LOG.error("Unable to lookup the Timer Manager: " + jndiName, t);
}
}
开发者ID:OSEHRA-Sandbox,项目名称:MOCHA,代码行数:34,代码来源:TimerServlet.java
示例2: setApplicationContext
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
/**
* Setter for application context
*
* @param context
* App context
*/
public void setApplicationContext(ApplicationContext context) {
this.applicationContext = context;
String deploymentType = System.getProperty("red5.deployment.type");
logger.debug("Deployment type: " + deploymentType);
if (deploymentType == null) {
// standalone core context
String config = System.getProperty("red5.conf_file");
if (config == null) {
config = "red5.xml";
}
coreContext = ContextSingletonBeanFactoryLocator.getInstance(config).useBeanFactory("red5.core").getFactory();
} else {
logger.info("Setting parent bean factory as core");
coreContext = applicationContext.getParentBeanFactory();
}
}
开发者ID:Red5,项目名称:red5-server,代码行数:23,代码来源:Context.java
示例3: setApplicationContext
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
/**
* Setter for application context
*
* @param context App context
*/
public void setApplicationContext(ApplicationContext context) {
this.applicationContext = context;
String deploymentType = System.getProperty("red5.deployment.type");
logger.debug("Deployment type: " + deploymentType);
if (deploymentType == null) {
// standalone core context
String config = System.getProperty("red5.conf_file");
if (config == null) {
config = "red5.xml";
}
coreContext = ContextSingletonBeanFactoryLocator.getInstance(config).useBeanFactory("red5.core")
.getFactory();
} else {
logger.info("Setting parent bean factory as core");
coreContext = applicationContext.getParentBeanFactory();
}
}
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:23,代码来源:Context.java
示例4: ComponentLoaderImpl
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
public ComponentLoaderImpl () throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException {
checkInit();
BeanFactoryLocator factoryLocator = ContextSingletonBeanFactoryLocator
.getInstance(String.format("classpath:%s", CoreGlobalProperty.BEAN_REF_CONTEXT_CONF));
BeanFactoryReference ref = factoryLocator.useBeanFactory("parentContext");
ioc = ref.getFactory();
}
开发者ID:zstackio,项目名称:zstack,代码行数:8,代码来源:ComponentLoaderImpl.java
示例5: loadParentContext
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
/**
* Template method with default implementation (which may be overridden by a
* subclass), to load or obtain an ApplicationContext instance which will be
* used as the parent context of the root WebApplicationContext. If the
* return value from the method is null, no parent context is set.
* <p>The main reason to load a parent context here is to allow multiple root
* web application contexts to all be children of a shared EAR context, or
* alternately to also share the same parent context that is visible to
* EJBs. For pure web applications, there is usually no need to worry about
* having a parent context to the root web application context.
* <p>The default implementation uses
* {@link org.springframework.context.access.ContextSingletonBeanFactoryLocator},
* configured via {@link #LOCATOR_FACTORY_SELECTOR_PARAM} and
* {@link #LOCATOR_FACTORY_KEY_PARAM}, to load a parent context
* which will be shared by all other users of ContextsingletonBeanFactoryLocator
* which also use the same configuration parameters.
* @param servletContext current servlet context
* @return the parent application context, or {@code null} if none
* @see org.springframework.context.access.ContextSingletonBeanFactoryLocator
*/
protected ApplicationContext loadParentContext(ServletContext servletContext) {
ApplicationContext parentContext = null;
String locatorFactorySelector = servletContext.getInitParameter(LOCATOR_FACTORY_SELECTOR_PARAM);
String parentContextKey = servletContext.getInitParameter(LOCATOR_FACTORY_KEY_PARAM);
if (parentContextKey != null) {
// locatorFactorySelector may be null, indicating the default "classpath*:beanRefContext.xml"
BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(locatorFactorySelector);
Log logger = LogFactory.getLog(ContextLoader.class);
if (logger.isDebugEnabled()) {
logger.debug("Getting parent context definition: using parent context key of '" +
parentContextKey + "' with BeanFactoryLocator");
}
this.parentContextRef = locator.useBeanFactory(parentContextKey);
parentContext = (ApplicationContext) this.parentContextRef.getFactory();
}
return parentContext;
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:40,代码来源:ContextLoader.java
示例6: setSessionContext
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
public void setSessionContext(SessionContext ctx) {
super.setSessionContext(ctx);
setBeanFactoryLocator(ContextSingletonBeanFactoryLocator.getInstance("classpath*:beanRefContext.xml"));
setBeanFactoryLocatorKey("applicationContext-main");
}
开发者ID:8090boy,项目名称:gomall.la,代码行数:6,代码来源:SessionFacade.java
示例7: setMessageDrivenContext
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext) {
super.setMessageDrivenContext(messageDrivenContext);
setBeanFactoryLocator(ContextSingletonBeanFactoryLocator.getInstance("classpath*:beanRefContext.xml"));
setBeanFactoryLocatorKey("applicationContext-main");
}
开发者ID:8090boy,项目名称:gomall.la,代码行数:6,代码来源:BaseMDB.java
示例8: doGet
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
/**
* Delegate GET requests to {@link #doService(ServletRequest, ServletResponse)}.
*
* @param request HttpServletRequest
* @param response HttpServletResponse
* @throws ServletException if error
* @throws IOException if error
*
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
@Override
protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
/* @todo (mspears:Mar 29, 2010) testing purposes only, should be disabled in production */
response.setContentType("text/html");
PrintWriter out = response.getWriter();
if (request.getParameter("lock") != null) {
// DifUpdater.RUNCOUNTER = 1;
// out.println("Order checks are locked out.");
}
else if (request.getParameter("unlock") != null) {
// DifUpdater.RUNCOUNTER = 0;
// out.println("Order checks are available.");
}
else {
String runCommand = request.getParameter("run");
if (runCommand == null) {
out.println("<p>Manually <a href='timer?run'><b>execute</b></a> the FDB-DIF update process.</p>");
out.println("<p>*This trigger is provided for testing purposes only.</p>");
}
else {
try {
DifUpdateCapability capability = (DifUpdateCapability) ContextSingletonBeanFactoryLocator.getInstance(
"classpath*:beanRefContext.xml").useBeanFactory("businessBeanFactory").getFactory().getBean(
"difUpdateCapability");
if (capability.execute()) {
out.println("<font color='blue'><h2>Updater ran successfully.</h2></font>");
out.println("See log for more information.");
}
else {
out
.println("<font color='orange'><h2>Updater ran successfully but no updates were processed. Should there have been?</h2></font>");
out.println("See log for more information.");
}
}
catch (Throwable t) {
out.println("<font color='red'><h2>Updater run failed!</h2></font>");
out.println("See log for more information.");
out.println("<pre>");
t.printStackTrace(out);
out.println("</pre>");
}
}
}
out.flush();
out.close();
}
开发者ID:OSEHRA-Sandbox,项目名称:MOCHA,代码行数:66,代码来源:TimerServlet.java
示例9: loadParentContext
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
/**
* Template method with default implementation (which may be overridden by a
* subclass), to load or obtain an ApplicationContext instance which will be
* used as the parent context of the root WebApplicationContext. If the
* return value from the method is null, no parent context is set.
* <p>The main reason to load a parent context here is to allow multiple root
* web application contexts to all be children of a shared EAR context, or
* alternately to also share the same parent context that is visible to
* EJBs. For pure web applications, there is usually no need to worry about
* having a parent context to the root web application context.
* <p>The default implementation uses
* {@link org.springframework.context.access.ContextSingletonBeanFactoryLocator},
* configured via {@link #LOCATOR_FACTORY_SELECTOR_PARAM} and
* {@link #LOCATOR_FACTORY_KEY_PARAM}, to load a parent context
* which will be shared by all other users of ContextsingletonBeanFactoryLocator
* which also use the same configuration parameters.
* @param servletContext current servlet context
* @return the parent application context, or <code>null</code> if none
* @throws BeansException if the context couldn't be initialized
* @see org.springframework.context.access.ContextSingletonBeanFactoryLocator
*/
protected ApplicationContext loadParentContext(ServletContext servletContext)
throws BeansException {
ApplicationContext parentContext = null;
String locatorFactorySelector = servletContext.getInitParameter(LOCATOR_FACTORY_SELECTOR_PARAM);
String parentContextKey = servletContext.getInitParameter(LOCATOR_FACTORY_KEY_PARAM);
if (parentContextKey != null) {
// locatorFactorySelector may be null, indicating the default "classpath*:beanRefContext.xml"
BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(locatorFactorySelector);
if (logger.isDebugEnabled()) {
logger.debug("Getting parent context definition: using parent context key of '" +
parentContextKey + "' with BeanFactoryLocator");
}
this.parentContextRef = locator.useBeanFactory(parentContextKey);
parentContext = (ApplicationContext) this.parentContextRef.getFactory();
}
return parentContext;
}
开发者ID:code4craft,项目名称:tavern,代码行数:42,代码来源:SpringTavernContextLoader.java
示例10: getBeanFactoryLocator
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
/**
* Determine the BeanFactoryLocator to obtain the BeanFactoryReference from.
* <p>The default implementation exposes Spring's default
* {@link ContextSingletonBeanFactoryLocator}.
* @param target the target bean to autowire
* @return the BeanFactoryLocator to use (never {@code null})
* @see org.springframework.context.access.ContextSingletonBeanFactoryLocator#getInstance()
*/
protected BeanFactoryLocator getBeanFactoryLocator(Object target) {
return ContextSingletonBeanFactoryLocator.getInstance();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:SpringBeanAutowiringInterceptor.java
示例11: setMessageDrivenContext
import org.springframework.context.access.ContextSingletonBeanFactoryLocator; //导入依赖的package包/类
/**
* Start Spring ApplicationContext
*
* @param messageDrivenContext Set the MBD context
*
* @see org.springframework.ejb.support.AbstractMessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext)
*/
public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext) {
super.setMessageDrivenContext(messageDrivenContext);
setBeanFactoryLocator(ContextSingletonBeanFactoryLocator.getInstance());
setBeanFactoryLocatorKey("businessBeanFactory");
}
开发者ID:OSEHRA-Sandbox,项目名称:MOCHA,代码行数:13,代码来源:AbstractPepsMessageDrivenBean.java
注:本文中的org.springframework.context.access.ContextSingletonBeanFactoryLocator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论