Class FilterSpringUtil


  • public class FilterSpringUtil
    extends java.lang.Object
    Util class for retrieving spring beans.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T getSpringBean​(javax.servlet.http.HttpServletRequest httpRequest, java.lang.String beanName, java.lang.Class<T> beanClass)
      Returns the Spring bean with name beanName and of type beanClass.
      static <T> T getSpringBean​(javax.servlet.ServletContext servletContext, java.lang.String beanName, java.lang.Class<T> beanClass)
      The same as getSpringBean(HttpServletRequest, String, Class) but uses ServletContext as the first parameter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getSpringBean

        public static <T> T getSpringBean​(javax.servlet.http.HttpServletRequest httpRequest,
                                          java.lang.String beanName,
                                          java.lang.Class<T> beanClass)
        Returns the Spring bean with name beanName and of type beanClass. If no bean could be resolved for the specified name, the bean is looked up using type.
        Type Parameters:
        T - type of the bean
        Parameters:
        httpRequest - the http request
        beanName - name of the bean or null if it should be automatically resolved using type
        beanClass - expected type of the bean
        Returns:
        the bean matching the given arguments or null if no bean could be resolved
      • getSpringBean

        public static <T> T getSpringBean​(javax.servlet.ServletContext servletContext,
                                          java.lang.String beanName,
                                          java.lang.Class<T> beanClass)
        The same as getSpringBean(HttpServletRequest, String, Class) but uses ServletContext as the first parameter. It might be used in places, where HttpServletRequest is not available, but ServletContext is.