Class SpringUtil

java.lang.Object
org.zkoss.spring.SpringUtil

public class SpringUtil extends Object
SpringUtil, a Spring utility.
Since:
1.0
Author:
henrichen
  • Constructor Details

    • SpringUtil

      public SpringUtil()
  • Method Details

    • getApplicationContext

      public static org.springframework.context.ApplicationContext getApplicationContext()
      Get the current spring application context.
      Returns:
      the current application context
      Throws:
      org.zkoss.zk.ui.UiException - when not in an active zk execution
    • getBean

      public static Object getBean(String name)
      Get the spring bean by the specified name.
      Parameters:
      name - the bean name
      Returns:
      the bean found in the current spring application context or null if no bean was found under the name
      See Also:
      • BeanFactory.getBean(java.lang.String)
    • getBean

      public static Object getBean(String name, Class cls)
      Get the spring bean by the specified name and class.
      Parameters:
      name - the bean name
      cls - the bean class
      Returns:
      the bean found in the current spring application context or null if no bean was found under the name
      See Also:
      • BeanFactory.getBean(java.lang.String, java.lang.Class)