List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext isSingleton
@Override public boolean isSingleton(String name) throws NoSuchBeanDefinitionException
From source file:org.ocelotds.spring.SpringResolver.java
@Override public Scope getScope(Class clazz) { logger.debug("Try to get scope of class {}", clazz); AnnotationConfigApplicationContext applicationCtx = this.getApplicationContext(); Map<String, ?> beansOfType = applicationCtx.getBeansOfType(clazz); if (beansOfType != null) { logger.debug("Try to get scope of class {} from beans", clazz); String bean = beansOfType.keySet().iterator().next(); logger.debug("Try to get scope of class {} from bean {}", clazz, bean); if (bean != null) { boolean prototype = applicationCtx.isPrototype(bean); boolean singleton = applicationCtx.isSingleton(bean); logger.debug("Try to get scope of class {} prototype : {}, singleton : {}", clazz, prototype, singleton);//from www .j a v a 2 s .c o m if (!prototype && !singleton) { return Scope.SESSION; } } } return Scope.MANAGED; }