Example usage for org.springframework.context ApplicationContext isSingleton

List of usage examples for org.springframework.context ApplicationContext isSingleton

Introduction

In this page you can find the example usage for org.springframework.context ApplicationContext isSingleton.

Prototype

boolean isSingleton(String name) throws NoSuchBeanDefinitionException;

Source Link

Document

Is this bean a shared singleton?

Usage

From source file:org.brushingbits.jnap.struts2.config.RestControllerConfigBuilder.java

@Override
protected Set<Class> findActions() {
    Set<Class> classes = new HashSet<Class>();

    final ApplicationContext ac = this.applicationContext;
    String[] beanNames = ac.getBeanDefinitionNames();
    for (String beanName : beanNames) {

        // don't care for the bean itself right now, just it's class
        Class beanClass = ac.getType(beanName);

        // first of all, check for the @Controller annotation...
        // then, if it's inside the right package (base controllers package)
        if (beanClass.isAnnotationPresent(Controller.class)
                && beanClass.getPackage().getName().startsWith(this.packageLocatorsBasePackage)) {
            // we must warn in case of a singleton scoped controller
            if (ac.isSingleton(beanName)) {
                LOG.warn(""); // TODO
            }/*from  ww  w  .jav a 2 s.  co  m*/
            classes.add(beanClass);
        }

    }
    return classes;
}