我正在使用springdoc-openapi-ui swagger。我不想硬编码swagger documentation
. 我想从属性文件中读取这些值。
当我尝试出现编译错误时The value for annotation attribute Operation.summary must be a constant expression.
我知道它正在寻找常量表达式,但我不想在我的代码中硬编码这些值。
请在此处找到我的控制器代码
@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);
}
}
有没有办法在端点注释中添加不同语言的消息属性?