Class BeanDefinitionUtils

java.lang.Object
org.craftercms.engine.util.spring.BeanDefinitionUtils

public class BeanDefinitionUtils extends Object
Utility methods for handling Spring bean definition.
Author:
avasquez
  • Method Details

    • createBeanDefinitionFromOriginal

      public static org.springframework.beans.factory.config.BeanDefinition createBeanDefinitionFromOriginal(org.springframework.context.ApplicationContext applicationContext, String beanName)
      Creates a bean definition for the specified bean name. If the parent context of the current context contains a bean definition with the same name, the definition is created as a bean copy of the parent definition. This method is useful for config parsers that want to create a bean definition from configuration but also want to retain the default properties of the original bean.
      Parameters:
      applicationContext - the current application context
      beanName -
      Returns:
      the bean definition
    • addPropertyIfNotNull

      public static void addPropertyIfNotNull(org.springframework.beans.factory.config.BeanDefinition definition, String propertyName, Object propertyValue)
      Adds the property to the bean definition if the values it not empty
      Parameters:
      definition - the bean definition
      propertyName - the property name
      propertyValue - the property value