/** * Associate the given message with the given code. * @param code lookup code * @param locale locale message should be found within * @param defaultMessage message associated with this lookup code * @see #getStaticMessageSource */ public void addMessage(String code, Locale locale, String defaultMessage) { getStaticMessageSource().addMessage(code, locale, defaultMessage); }
/** * Sets the id of this context to the bean name by default, * for cases where the context instance is itself defined as a bean. */ @Override public void setBeanName(String name) { if (!this.setIdCalled) { super.setId(name); setDisplayName("ApplicationContext '" + name + "'"); } }
@Override public Class<?> loadClass(String name) throws ClassNotFoundException { return new ContextOverridingClassLoader(getParent()).loadClass(name); }
/** * Return a bean factory with attributes and EnterpriseServices configured. */ protected BeanFactory getBeanFactory() throws IOException { return new ClassPathXmlApplicationContext(DEFAULT_CONTEXT, CLASS); }
@Override protected ApplicationContext getApplicationContext() { return new GenericXmlApplicationContext( "/org/springframework/cache/jcache/config/jCacheStandaloneConfig.xml"); }
/** * Create a new GenericXmlApplicationContext, loading bean definitions * from the given resource locations and automatically refreshing the context. * @param resourceLocations the resources to load from */ public GenericXmlApplicationContext(String... resourceLocations) { load(resourceLocations); refresh(); }
/** * Tell the subclass to refresh the internal bean factory. * @return the fresh BeanFactory instance * @see #refreshBeanFactory() * @see #getBeanFactory() */ protected ConfigurableListableBeanFactory obtainFreshBeanFactory() { refreshBeanFactory(); return getBeanFactory(); }
/** * Return this context's internal bean factory as AutowireCapableBeanFactory, * if already available. * @see #getBeanFactory() */ @Override public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException { return getBeanFactory(); }
/** * Clear the resource bundle caches of this MessageSource and all its ancestors. * @see #clearCache */ public void clearCacheIncludingAncestors() { clearCache(); if (getParentMessageSource() instanceof ReloadableResourceBundleMessageSource) { ((ReloadableResourceBundleMessageSource) getParentMessageSource()).clearCacheIncludingAncestors(); } }
/** * Publish the given event to all listeners. * <p>Note: Listeners get initialized after the MessageSource, to be able * to access it within listener implementations. Thus, MessageSource * implementations cannot publish events. * @param event the event to publish (may be application-specific or a * standard framework event) */ @Override public void publishEvent(ApplicationEvent event) { publishEvent(event, null); }
@Override public void onClose() { stopBeans(); this.running = false; }
@Override public void setId(String id) { super.setId(id); this.setIdCalled = true; }
@Override public void initialize(GenericApplicationContext applicationContext) { applicationContext.registerAlias("foo", "bar"); } }
@Override protected ApplicationContext getApplicationContext() { return new GenericXmlApplicationContext( "/org/springframework/cache/config/annotation-jcache-aspectj.xml"); }
/** * Create a new GenericGroovyApplicationContext, loading bean definitions * from the given resource locations and automatically refreshing the context. * @param relativeClass class whose package will be used as a prefix when * loading each specified resource name * @param resourceNames relatively-qualified names of resources to load */ public GenericGroovyApplicationContext(Class<?> relativeClass, String... resourceNames) { load(relativeClass, resourceNames); refresh(); }
/** * Publish the given event to all listeners. * <p>Note: Listeners get initialized after the MessageSource, to be able * to access it within listener implementations. Thus, MessageSource * implementations cannot publish events. * @param event the event to publish (may be an {@link ApplicationEvent} * or a payload object to be turned into a {@link PayloadApplicationEvent}) */ @Override public void publishEvent(Object event) { publishEvent(event, null); }
@Override protected ConfigurableApplicationContext getApplicationContext() { return new GenericXmlApplicationContext( "/org/springframework/cache/config/annotationDrivenCacheNamespace.xml"); }
@Override protected ApplicationContext getApplicationContext() { return new GenericXmlApplicationContext( "/org/springframework/cache/jcache/config/jCacheNamespaceDriven.xml"); }
@Override protected ConfigurableApplicationContext getApplicationContext() { return new GenericXmlApplicationContext( "/org/springframework/cache/config/cache-advice.xml"); }