注释类型 PropertyMapping


  • @Documented
    @Retention(RUNTIME)
    @Target({TYPE,METHOD})
    public @interface PropertyMapping
    Indicates that attributes from a test annotation should be mapped into a PropertySource. Can be used at the type level, or on individual attributes. For example, the following annotation declaration:
     @Retention(RUNTIME)
     @PropertyMapping("my.example")
     public @interface Example {
    
       String name();
    
     }
     
    When used on a test class as follows:
     @Example(name="Spring")
     public class MyTest {
     }
     
    will result in a my.example.name property being added with the value "Spring".

    从以下版本开始:
    1.4.0
    另请参阅:
    AnnotationsPropertySource, TestPropertySource
    • 可选元素概要

      可选元素 
      修饰符和类型可选元素说明
      SkipPropertyMappingskip
      Determines if mapping should be skipped.
      Stringvalue
      Defines the property mapping.
    • 元素详细资料

      • value

        String value
        Defines the property mapping. When used at the type-level, this value will be used as a prefix for all mapped attributes. When used on an attribute, the value overrides the generated (kebab case) name.
        返回:
        the property mapping
        默认值:
        ""
      • skip

        SkipPropertyMapping skip
        Determines if mapping should be skipped. When specified at the type-level indicates if skipping should occur by default or not. When used at the attribute-level, overrides the type-level default.
        返回:
        if mapping should be skipped
        默认值:
        org.springframework.boot.test.autoconfigure.properties.SkipPropertyMapping.NO