Java 我想从MessageResource(即message.properties)中读取接口内的文档部分

Java 我想从MessageResource(即message.properties)中读取接口内的文档部分,java,spring-boot,swagger,Java,Spring Boot,Swagger,我的项目结构如下 src - /com/dev/api APIInterface.java APIController.java - /resources -i18 -messages.properties 我的API接口看起来像 APIInterface.java import java.util.List; import javax.validation.Valid; import javax.valid

我的项目结构如下

src
   - /com/dev/api
        APIInterface.java
        APIController.java
   - /resources
        -i18
           -messages.properties
我的API接口看起来像 APIInterface.java


import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.Size;

import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;


@RestController
@Validated
@Tag(name = "Definition Inquiry", description = "The Definition API")
public interface APIInterface {

    @Operation(summary = "{summary.api}", description = "Get List of Definitions on dp number search.")
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200", description = "Successful response", content = {
                    @Content(mediaType = "application/json", schema = @Schema(implementation = DefinitionOne.class)) }),
            @ApiResponse(responseCode = "204", description = "No Content", content = {
                    @Content(mediaType = "application/json", schema = @Schema(implementation = String.class)) }),                       
            @ApiResponse(responseCode = "500", description = "Internal Error", content = {
                    @Content(mediaType = "application/json", schema = @Schema(implementation = FailureDefinition.class)) }) })
    @GetMapping("/dev/defs")
    ResponseEntity<List<DefSummary>> getDefinitions( 
            @Parameter(description = "Definition Parameter")
            @RequestParam("df") 
            @Valid
            @Size(min=7,message="{dp.length.fail.msg}")
            String df) throws Exception;
    
}

当我运行应用程序并检查时,swagger不理解messages.properties中要替换的令牌。

尽管它可以很好地处理验证消息。对于
dp.length.fail.msg
,输入少于7个字符,以提供来自messages.properties的准确信息,如下图所示。

但是如果是虚张声势的ui
summary.api
则不可读

是否可以读取接口内的messages.properties键

summary.api=Get List Of Definitions API
dp.length.fail.msg=Minimum length should be {min}