private boolean hasScopeAnnotation ( final Class < ? > type , final boolean hkManaged ) { boolean found = false ; for ( Annotation ann : type . getAnnotations ( ) ) { final Class < ? extends Annotation > annType = ann . annotationType ( ) ; if ( annType . isAnnotationPresent ( Scope . class ) ) { found = true ; break ; } // guice has special marker annotation if ( ! hkManaged && annType . isAnnotationPresent ( ScopeAnnotation . class ) ) { found = true ; break ; } } return found ; }
Checks scope annotation presence directly on bean . Base classes are not checked as scope is not inheritable .