SpringBoot自动配置
作者:
第八区 | 来源:发表于
2017-06-19 19:05 被阅读32次
配置属性类
@Data
@Component
@ConfigurationProperties(prefix = "interceptor.token")
public class TokenProperty {
private boolean enable = true;
private String pathPatterns;
private String excludePath;
private String key;
private long expire;
}
- 如果这里添加了注解那么在自动配置类的时候就不用添加
@enableConfigurationProperties(TokenProperty.class)
注解
- prefix 配置文件中的前缀
- enable=true 如果自动配置没有读入成功,那么为默认值
对应配置文件
interceptor.token.enable=true
interceptor.token.expire=3600
interceptor.token.key=dG9rZW4xMjM0NTY=
interceptor.token.pathPatterns=/api/**
interceptor.token.excludePath=/api/user/login
本文标题:SpringBoot自动配置
本文链接:https://www.haomeiwen.com/subject/zulnqxtx.html
网友评论