org.springframework.context.annotation

Class Jsr330ScopeMetadataResolver

  • java.lang.Object
    • org.springframework.context.annotation.Jsr330ScopeMetadataResolver
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void registerScope(java.lang.Class<?> annotationType, java.lang.String scopeName)
      Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name.
      void registerScope(java.lang.String annotationType, java.lang.String scopeName)
      Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name.
      ScopeMetadata resolveScopeMetadata(BeanDefinition definition)
      Resolve the ScopeMetadata appropriate to the supplied bean definition.
      protected java.lang.String resolveScopeName(java.lang.String annotationType)
      Resolve the given annotation type into a named Spring scope.
      • Methods inherited from class java.lang.Object

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

      • Jsr330ScopeMetadataResolver

        public Jsr330ScopeMetadataResolver()
    • Method Detail

      • registerScope

        public final void registerScope(java.lang.Class<?> annotationType,
                                        java.lang.String scopeName)
        Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name.
        Parameters:
        annotationType - the JSR-330 annotation type as a Class
        scopeName - the Spring scope name
      • registerScope

        public final void registerScope(java.lang.String annotationType,
                                        java.lang.String scopeName)
        Register an extended JSR-330 scope annotation, mapping it onto a specific Spring scope by name.
        Parameters:
        annotationType - the JSR-330 annotation type by name
        scopeName - the Spring scope name
      • resolveScopeName

        @Nullable
        protected java.lang.String resolveScopeName(java.lang.String annotationType)
        Resolve the given annotation type into a named Spring scope.

        The default implementation simply checks against registered scopes. Can be overridden for custom mapping rules, e.g. naming conventions.

        Parameters:
        annotationType - the JSR-330 annotation type
        Returns:
        the Spring scope name
      • resolveScopeMetadata

        public ScopeMetadata resolveScopeMetadata(BeanDefinition definition)
        Description copied from interface: ScopeMetadataResolver
        Resolve the ScopeMetadata appropriate to the supplied bean definition.

        Implementations can of course use any strategy they like to determine the scope metadata, but some implementations that spring immediately to mind might be to use source level annotations present on the class of the supplied definition, or to use metadata present in the AttributeAccessor.attributeNames() of the supplied definition.

        Specified by:
        resolveScopeMetadata in interface ScopeMetadataResolver
        Parameters:
        definition - the target bean definition
        Returns:
        the relevant scope metadata; never null