Class BeanFactoryModelFactory

  • All Implemented Interfaces:
    NodeTemplateModelFactory, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware

    public class BeanFactoryModelFactory
    extends Object
    implements NodeTemplateModelFactory, org.springframework.beans.factory.BeanFactoryAware
    NodeTemplateModelFactory that always returns the BeanFactory of the Spring application context where this factory is configured. Very useful in conjunction with the SpELStringTemplateCompiler, since you can use SpEL in the node template just as you would use SpEl in a Spring XML configuration file.
    Author:
    Alfonso Vásquez
    • Constructor Detail

      • BeanFactoryModelFactory

        public BeanFactoryModelFactory()
    • Method Detail

      • setBeanFactory

        public void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)
        Sets the BeanFactory of the current Spring application context.
        Specified by:
        setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      • getModel

        public Object getModel​(Item item,
                               org.dom4j.Node node,
                               String template)
        Returns always the BeanFactory of the current Spring application context as the model.
        Specified by:
        getModel in interface NodeTemplateModelFactory
        Parameters:
        item - the Item whose descriptor contains the specified node
        node - the DOM node whose content is the specified template
        template - the actual template
        Returns:
        the model to be used for processing the specified template