0

I have so many Controllers and API methods in those controllers. I have this AWS - Swagger configuration in all the API methods. Is there any option to simplify this? I want to move this repetitive annotation configuration @Extension's to somewhere, so that I do not need to type again and again.

@Operation(extensions = { @Extension(name = "amazon-apigateway-integration", properties = {
        @ExtensionProperty(name = "type", value = "HTTP_PROXY"),
        @ExtensionProperty(name = "httpMethod", value = "POST"),
        @ExtensionProperty(name = "uri", value = "http://localhost:9090/addUser"), }) }, summary = "Add User API", responses = {
                        @ApiResponse(responseCode = "403", content = @Content(mediaType = "application/json")) })

@PostMapping(value = "addUser")
public ResponseEntity<Object> addUser(Authentication authentication, @RequestBody UserDTO userDTO)
        throws VerificationException { }
Arunkumar S
  • 112
  • 2
  • 14
  • Does these Q&As answer your question? [How to DRY when using Swagger UI and the ApiResponses annotations with Java Spring endpoints?](https://stackoverflow.com/q/48634417/113116), [Composite annotations to reuse](https://stackoverflow.com/q/65103371/113116) – Helen Oct 16 '22 at 08:11
  • Thanks for the reply. But still I face issue. How can I take Extension Properties as a annotation parameter in Custom annotation? @AliasFor(annotation = Extension.class, attribute = "name") String name() default "amazon-apigateway-integration"; ExtensionProperty[] properties(); where Properties like httpMethod and uri are different for each requests. – Arunkumar S Oct 17 '22 at 07:58

0 Answers0