implementation
which supports programmatic registration of beans and messages,
rather than reading bean definitions from external configuration sources.
Mainly useful for testing.
| Method from org.springframework.context.support.StaticApplicationContext Detail: |
public void addMessage(String code,
Locale locale,
String defaultMessage) {
getStaticMessageSource().addMessage(code, locale, defaultMessage);
}
Associate the given message with the given code. |
public final StaticMessageSource getStaticMessageSource() {
return this.staticMessageSource;
}
Return the internal StaticMessageSource used by this context.
Can be used to register messages on it. |
public void registerPrototype(String name,
Class clazz) throws BeansException {
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE);
bd.setBeanClass(clazz);
getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
}
Register a prototype bean with the underlying bean factory.
For more advanced needs, register with the underlying BeanFactory directly. |
public void registerPrototype(String name,
Class clazz,
MutablePropertyValues pvs) throws BeansException {
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE);
bd.setBeanClass(clazz);
bd.setPropertyValues(pvs);
getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
}
Register a prototype bean with the underlying bean factory.
For more advanced needs, register with the underlying BeanFactory directly. |
public void registerSingleton(String name,
Class clazz) throws BeansException {
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setBeanClass(clazz);
getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
}
Register a singleton bean with the underlying bean factory.
For more advanced needs, register with the underlying BeanFactory directly. |
public void registerSingleton(String name,
Class clazz,
MutablePropertyValues pvs) throws BeansException {
GenericBeanDefinition bd = new GenericBeanDefinition();
bd.setBeanClass(clazz);
bd.setPropertyValues(pvs);
getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
}
Register a singleton bean with the underlying bean factory.
For more advanced needs, register with the underlying BeanFactory directly. |