Class EndpointDiscoverer<E extends ExposableEndpoint<O>,O extends Operation>
java.lang.Object
org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer<E,O>
- Type Parameters:
E
- the endpoint typeO
- the operation type
- All Implemented Interfaces:
EndpointsSupplier<E>
- Direct Known Subclasses:
ControllerEndpointDiscoverer
,JmxEndpointDiscoverer
,ServletEndpointDiscoverer
,WebEndpointDiscoverer
public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>,O extends Operation>
extends Object
implements EndpointsSupplier<E>
A Base for
EndpointsSupplier
implementations that discover
@Endpoint
beans and @EndpointExtension
beans
in an application context.- Since:
- 2.0.0
- Author:
- Andy Wilkinson, Stephane Nicoll, Phillip Webb
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static final class
A key generated for anOperation
based on specific criteria from the actual operation implementation. -
Constructor Summary
ConstructorDescriptionEndpointDiscoverer
(ApplicationContext applicationContext, ParameterValueMapper parameterValueMapper, Collection<OperationInvokerAdvisor> invokerAdvisors, Collection<EndpointFilter<E>> endpointFilters) Deprecated, for removal: This API element is subject to removal in a future version.EndpointDiscoverer
(ApplicationContext applicationContext, ParameterValueMapper parameterValueMapper, Collection<OperationInvokerAdvisor> invokerAdvisors, Collection<EndpointFilter<E>> endpointFilters, Collection<OperationFilter<O>> operationFilters) Create a newEndpointDiscoverer
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected E
createEndpoint
(Object endpointBean, EndpointId id, boolean enabledByDefault, Collection<O> operations) Deprecated, for removal: This API element is subject to removal in a future version.since 3.4.0 for removal in 3.6.0 in favor ofcreateEndpoint(Object, EndpointId, Access, Collection)
protected abstract E
createEndpoint
(Object endpointBean, EndpointId id, Access defaultAccess, Collection<O> operations) Factory method called to create theendpoint
.protected abstract O
createOperation
(EndpointId endpointId, DiscoveredOperationMethod operationMethod, OperationInvoker invoker) Factory method to create anendpoint operation
.protected abstract EndpointDiscoverer.OperationKey
createOperationKey
(O operation) Create anEndpointDiscoverer.OperationKey
for the given operation.final Collection<E>
Return the provided endpoints.protected boolean
isEndpointTypeExposed
(Class<?> beanType) Determine if an endpoint bean should be exposed.protected boolean
isExtensionTypeExposed
(Class<?> extensionBeanType) Determine if an extension bean should be exposed.protected boolean
isInvocable
(E endpoint) Returns whether the endpoint is invocable and should be included in the discovered endpoints.
-
Constructor Details
-
EndpointDiscoverer
@Deprecated(since="3.4.0", forRemoval=true) public EndpointDiscoverer(ApplicationContext applicationContext, ParameterValueMapper parameterValueMapper, Collection<OperationInvokerAdvisor> invokerAdvisors, Collection<EndpointFilter<E>> endpointFilters) Deprecated, for removal: This API element is subject to removal in a future version.since 3.4.0 for removal in 3.6.0 in favor ofEndpointDiscoverer(ApplicationContext, ParameterValueMapper, Collection, Collection, Collection)
Create a newEndpointDiscoverer
instance.- Parameters:
applicationContext
- the source application contextparameterValueMapper
- the parameter value mapperinvokerAdvisors
- invoker advisors to applyendpointFilters
- endpoint filters to apply
-
EndpointDiscoverer
public EndpointDiscoverer(ApplicationContext applicationContext, ParameterValueMapper parameterValueMapper, Collection<OperationInvokerAdvisor> invokerAdvisors, Collection<EndpointFilter<E>> endpointFilters, Collection<OperationFilter<O>> operationFilters) Create a newEndpointDiscoverer
instance.- Parameters:
applicationContext
- the source application contextparameterValueMapper
- the parameter value mapperinvokerAdvisors
- invoker advisors to applyendpointFilters
- endpoint filters to applyoperationFilters
- operation filters to apply- Since:
- 3.4.0
-
-
Method Details
-
getEndpoints
Description copied from interface:EndpointsSupplier
Return the provided endpoints.- Specified by:
getEndpoints
in interfaceEndpointsSupplier<E extends ExposableEndpoint<O>>
- Returns:
- the endpoints
-
isInvocable
Returns whether the endpoint is invocable and should be included in the discovered endpoints. The default implementation returnstrue
if the endpoint has any operations, otherwisefalse
.- Parameters:
endpoint
- the endpoint to assess- Returns:
true
if the endpoint is invocable, otherwisefalse
.- Since:
- 3.4.0
-
isExtensionTypeExposed
Determine if an extension bean should be exposed. Subclasses can override this method to provide additional logic.- Parameters:
extensionBeanType
- the extension bean type- Returns:
true
if the extension is exposed
-
isEndpointTypeExposed
Determine if an endpoint bean should be exposed. Subclasses can override this method to provide additional logic.- Parameters:
beanType
- the endpoint bean type- Returns:
true
if the endpoint is exposed
-
getEndpointType
-
createEndpoint
@Deprecated(since="3.4.0", forRemoval=true) protected E createEndpoint(Object endpointBean, EndpointId id, boolean enabledByDefault, Collection<O> operations) Deprecated, for removal: This API element is subject to removal in a future version.since 3.4.0 for removal in 3.6.0 in favor ofcreateEndpoint(Object, EndpointId, Access, Collection)
Factory method called to create theendpoint
.- Parameters:
endpointBean
- the source endpoint beanid
- the ID of the endpointenabledByDefault
- if the endpoint is enabled by defaultoperations
- the endpoint operations- Returns:
- a created endpoint (a
DiscoveredEndpoint
is recommended)
-
createEndpoint
protected abstract E createEndpoint(Object endpointBean, EndpointId id, Access defaultAccess, Collection<O> operations) Factory method called to create theendpoint
.- Parameters:
endpointBean
- the source endpoint beanid
- the ID of the endpointdefaultAccess
- access to the endpoint that is permitted by defaultoperations
- the endpoint operations- Returns:
- a created endpoint (a
DiscoveredEndpoint
is recommended)
-
createOperation
protected abstract O createOperation(EndpointId endpointId, DiscoveredOperationMethod operationMethod, OperationInvoker invoker) Factory method to create anendpoint operation
.- Parameters:
endpointId
- the endpoint idoperationMethod
- the operation methodinvoker
- the invoker to use- Returns:
- a created operation
-
createOperationKey
Create anEndpointDiscoverer.OperationKey
for the given operation.- Parameters:
operation
- the source operation- Returns:
- the operation key
-
EndpointDiscoverer(ApplicationContext, ParameterValueMapper, Collection, Collection, Collection)