标签:work field pre col div 详细 ram target tty
将属性文件与一个Java类绑定,属性文件中的变量与Java类中的成员变量一一对应,无需完全一致。
如需将 @ConfigurationProperties 注解的目标类添加到Spring IOC容器中,可以
package org.springframework.boot.context.properties; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.core.annotation.AliasFor; @Target({ ElementType.TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface ConfigurationProperties { /** * 属性文件中变量的前缀 * 如果变量的全名是server.port,那么value==server。 */ @AliasFor("prefix") String value() default ""; /** * 属性文件中变量的前缀 * 如果变量的全名是server.port,那么prefix==server。 */ @AliasFor("value") String prefix() default ""; /** * 是否忽略类型不匹配的错误 */ boolean ignoreInvalidFields() default false; /** * 是否忽略属性变量对应的字段不存在的错误 */ boolean ignoreUnknownFields() default true; }
标签:work field pre col div 详细 ram target tty
原文地址:https://www.cnblogs.com/517cn/p/10946519.html