Package com.linecorp.armeria.spring
Class AnnotatedServiceRegistrationBean
java.lang.Object
com.linecorp.armeria.spring.AbstractServiceRegistrationBean<Object,AnnotatedServiceRegistrationBean,AnnotatedExampleRequest,ExampleHeaders>
com.linecorp.armeria.spring.AnnotatedServiceRegistrationBean
public class AnnotatedServiceRegistrationBean extends AbstractServiceRegistrationBean<Object,AnnotatedServiceRegistrationBean,AnnotatedExampleRequest,ExampleHeaders>
A bean with information for registering an annotated service object.
It enables Micrometer metric collection of the service automatically.
> @Bean
> public AnnotatedServiceRegistrationBean okService() {
> return new AnnotatedServiceRegistrationBean()
> .setServiceName("myAnnotatedService")
> .setPathPrefix("/my_service")
> .setService(new MyAnnotatedService())
> .setDecorators(LoggingService.newDecorator())
> .setExceptionHandlers(new MyExceptionHandler())
> .setRequestConverters(new MyRequestConverter())
> .setResponseConverters(new MyResponseConverter())
> .addExampleRequests(AnnotatedExampleRequest.of("myMethod", "{\"foo\":\"bar\"}"))
> .addExampleHeaders(ExampleHeaders.of("my-header", "headerVal"));
> }
-
Constructor Summary
Constructors Constructor Description AnnotatedServiceRegistrationBean()
-
Method Summary
Modifier and Type Method Description AnnotatedServiceRegistrationBean
addExampleHeaders(CharSequence name, String value)
Adds an example HTTP header for all service methods.AnnotatedServiceRegistrationBean
addExampleHeaders(String methodName, @NotNull HttpHeaders... exampleHeaders)
Adds example HTTP headers for the specified method.AnnotatedServiceRegistrationBean
addExampleHeaders(String methodName, @NotNull Iterable<? extends HttpHeaders> exampleHeaders)
Adds example HTTP headers for the specified method.AnnotatedServiceRegistrationBean
addExampleHeaders(String methodName, HttpHeaders exampleHeaders)
Adds an example HTTP header for the specified method.AnnotatedServiceRegistrationBean
addExampleHeaders(String methodName, CharSequence name, String value)
Adds an example HTTP header for the specified method.AnnotatedServiceRegistrationBean
addExampleRequests(@NotNull String methodName, @NotNull Object exampleRequest)
Adds an example request forAbstractServiceRegistrationBean.getService()
.Collection<? extends ExceptionHandlerFunction>
getExceptionHandlers()
Returns the exception handlers of the annotated service object.@NotNull String
getPathPrefix()
Returns the path prefix.Collection<? extends RequestConverterFunction>
getRequestConverters()
Returns the request converters of the annotated service object.Collection<? extends ResponseConverterFunction>
getResponseConverters()
Returns the response converters of the annotated service object.AnnotatedServiceRegistrationBean
setExceptionHandlers(ExceptionHandlerFunction... exceptionHandlers)
Sets the exception handlers of the annotated service object.AnnotatedServiceRegistrationBean
setExceptionHandlers(Collection<? extends ExceptionHandlerFunction> exceptionHandlers)
Sets the exception handlers of the annotated service object.AnnotatedServiceRegistrationBean
setPathPrefix(@NotNull String pathPrefix)
Sets the path prefix.AnnotatedServiceRegistrationBean
setRequestConverters(RequestConverterFunction... requestConverters)
Sets the request converters of the annotated service object.AnnotatedServiceRegistrationBean
setRequestConverters(Collection<? extends RequestConverterFunction> requestConverters)
Sets the request converters of the annotated service object.AnnotatedServiceRegistrationBean
setResponseConverters(ResponseConverterFunction... responseConverters)
Sets the response converters of the annotated service object.AnnotatedServiceRegistrationBean
setResponseConverters(Collection<? extends ResponseConverterFunction> responseConverters)
Sets the response converters of the annotated service object.Methods inherited from class com.linecorp.armeria.spring.AbstractServiceRegistrationBean
addExampleHeaders, addExampleHeaders, addExampleHeaders, addExampleRequests, addExampleRequests, addExampleRequests, getDecorators, getExampleHeaders, getExampleRequests, getService, getServiceName, setDecorators, setDecorators, setExampleHeaders, setExampleHeaders, setExampleHeaders, setExampleRequests, setExampleRequests, setExampleRequests, setService, setServiceName
-
Constructor Details
-
AnnotatedServiceRegistrationBean
public AnnotatedServiceRegistrationBean()
-
-
Method Details
-
getPathPrefix
Returns the path prefix. -
setPathPrefix
Sets the path prefix. -
getExceptionHandlers
Returns the exception handlers of the annotated service object. -
setExceptionHandlers
public AnnotatedServiceRegistrationBean setExceptionHandlers(Collection<? extends ExceptionHandlerFunction> exceptionHandlers)Sets the exception handlers of the annotated service object. -
setExceptionHandlers
public AnnotatedServiceRegistrationBean setExceptionHandlers(ExceptionHandlerFunction... exceptionHandlers)Sets the exception handlers of the annotated service object. -
getRequestConverters
Returns the request converters of the annotated service object. -
setRequestConverters
public AnnotatedServiceRegistrationBean setRequestConverters(Collection<? extends RequestConverterFunction> requestConverters)Sets the request converters of the annotated service object. -
setRequestConverters
public AnnotatedServiceRegistrationBean setRequestConverters(RequestConverterFunction... requestConverters)Sets the request converters of the annotated service object. -
getResponseConverters
Returns the response converters of the annotated service object. -
setResponseConverters
public AnnotatedServiceRegistrationBean setResponseConverters(Collection<? extends ResponseConverterFunction> responseConverters)Sets the response converters of the annotated service object. -
setResponseConverters
public AnnotatedServiceRegistrationBean setResponseConverters(ResponseConverterFunction... responseConverters)Sets the response converters of the annotated service object. -
addExampleRequests
public AnnotatedServiceRegistrationBean addExampleRequests(@NotNull @NotNull String methodName, @NotNull @NotNull Object exampleRequest)Adds an example request forAbstractServiceRegistrationBean.getService()
. -
addExampleHeaders
Adds an example HTTP header for all service methods. -
addExampleHeaders
public AnnotatedServiceRegistrationBean addExampleHeaders(String methodName, HttpHeaders exampleHeaders)Adds an example HTTP header for the specified method. -
addExampleHeaders
public AnnotatedServiceRegistrationBean addExampleHeaders(String methodName, CharSequence name, String value)Adds an example HTTP header for the specified method. -
addExampleHeaders
public AnnotatedServiceRegistrationBean addExampleHeaders(String methodName, @NotNull @NotNull Iterable<? extends HttpHeaders> exampleHeaders)Adds example HTTP headers for the specified method. -
addExampleHeaders
public AnnotatedServiceRegistrationBean addExampleHeaders(String methodName, @NotNull @NotNull HttpHeaders... exampleHeaders)Adds example HTTP headers for the specified method.
-