Java Code Examples for

Following code examples demonstrate how to use spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use various code implementation of this class.

    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {

        BeanDefinition bd = BeanDefinitionBuilder.genericBeanDefinition(ResourceBundleMessageSource.class)
            .addPropertyValue("alwaysUseMessageFormat", true)
            .addPropertyValue("basename", I18N_PROPERTIES_BASENAME)
            .addPropertyValue("defaultEncoding", "UTF-8")

        String beanName = AbstractApplicationContext.MESSAGE_SOURCE_BEAN_NAME;

        if (registry.containsBeanDefinition(beanName)) {

            BeanDefinition original = registry.getBeanDefinition(beanName);

            ManagedArray array = new ManagedArray(MessageSource.class.getName(), 2);

            BeanDefinition composite = BeanDefinitionBuilder.genericBeanDefinition(CompositeMessageSource.class)

            registry.registerBeanDefinition(beanName, composite);

        } else {
            registry.registerBeanDefinition(beanName, bd);

Tag collection class used to hold managed array elements, which may include runtime bean references

(to be resolved into bean objects). @author Juergen Hoeller @since 3.0

Read More