Class ViewSetupBeanPostProcessor

java.lang.Object
io.jstach.opt.spring.webflux.ViewSetupBeanPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanPostProcessor

public class ViewSetupBeanPostProcessor extends Object implements org.springframework.beans.factory.config.BeanPostProcessor
A BeanPostProcessor that it registers a HandlerResultHandler that automatically applies all JStachioModelViewConfigurer instances to views before rendering.
  • Constructor Details

    • ViewSetupBeanPostProcessor

      public ViewSetupBeanPostProcessor(org.springframework.context.ApplicationContext context)
      Constructor for Spring to inject the application context.
      Parameters:
      context - supplied by spring used to look for JStachioModelViewConfigurers.
  • Method Details

    • postProcessAfterInitialization

      public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException
      Look for a ViewResolutionResultHandler and replace it with a wrapper that configures JStachioModelView instance using the JStachioModelViewConfigurers in the current context.
      Specified by:
      postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
      Parameters:
      bean - the bean that is being created
      beanName - the name of the bean
      Returns:
      Object a bean wrapped with ViewSetupBeanPostProcessor.ViewSetupResultHandler if needed
      Throws:
      org.springframework.beans.BeansException - in case of errors