I am working with springdoc-openapi-ui swagger. I don't want to hard code the values for swagger documentation
. I want to read such values from the properties file.
When I tried that I am getting compilation error The value for annotation attribute Operation.summary must be a constant expression.
I know it is looking for constant expression, but I don't want to hard code these values in my code.
Please find my controller code here
@RestController
@PropertySource("classpath:test.properties")
public class TestController {
@Autowired
private TestService testService;
@Autowired
private static Environment environment;
final String SUMMARY = environment.getProperty("operationSummary");
@Operation(summary = SUMMARY, description = "Returns a list", tags = { "Test" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successful operation") })
@GetMapping(path = "/description/{id}")
public List<Test> getDescriptionById(@PathVariable String id) {
return testService.getDescriptionById(id);
}
}
Is there a way to add message properties for different languages in the end point annotations?