Package org.springframework.security.core.annotation

# Interface SecurityAnnotationScanner<A extends Annotation>

Type Parameters:
  `A` - the annotation to search for and synthesize

public interface SecurityAnnotationScanner<A extends Annotation>
An interface to scan for and synthesize an annotation on a type, method, or method parameter into an annotation of type `<A>`.

Implementations should support meta-annotations. This is usually by way of the `MergedAnnotations` API.

Synthesis generally refers to the process of taking an annotation's meta-annotations and placeholders, resolving them, and then combining these elements into a facade of the raw annotation instance.

Since the process of synthesizing an annotation can be expensive, it's recommended to cache the synthesized annotation to prevent multiple computations.

Since:
  6.4
See Also:
  - `UniqueSecurityAnnotationScanner`
  - `ExpressionTemplateSecurityAnnotationScanner`

## Method Summary

Modifier and Type
Method
Description
`A`
`scan(Method method, Class<?> targetClass)`
Scan for an annotation of type `A`, starting from the given method.
`A`
`scan(Parameter parameter)`
Scan for an annotation of type `A`, starting from the given method parameter.

## Method Details

### scan

@Nullable A scan(Method method, Class<?> targetClass)
Scan for an annotation of type `A`, starting from the given method.

Implementations should fail if they encounter more than one annotation of that type attributable to the method.

Implementations should describe their strategy for searching the element and any surrounding class, interfaces, or super-class.

Parameters:
  `method` - the method to search from
  `targetClass` - the target class for the method
Returns:
  the synthesized annotation or `null` if not found

### scan

@Nullable A scan(Parameter parameter)
Scan for an annotation of type `A`, starting from the given method parameter.

Implementations should fail if they encounter more than one annotation of that type attributable to the parameter.

Implementations should describe their strategy for searching the element and any surrounding class, interfaces, or super-class.

Parameters:
  `element` - the element to search
Returns:
  the synthesized annotation or `null` if not found