admin管理员组

文章数量:1530018

需求

1.Springboot项目中,拦截器中想要获取到application.yml中的值
2.Springboot项目中,拦截器中想要注入 RestTemplate或者其他对象
3.Springboot项目中,使用了拦截器如果过滤掉swagger,让swagger可以正常访问。

实现

InterceptorProperties.java

读取application.yml中user开头的配置。

@Component
@ConfigurationProperties(prefix = "user")
public class InterceptorProperties {
    private String path;
    private String index;
    private String noauth;
    public String getNoauth() {
        return noauth;
    }
    public void setNoauth(String noauth) {
        this.noauth = noauth;
    }
    public String getIndex() {
        return index;
    }
    public void setIndex(String index) {
        this.index = index;
    }
    public String getPath() {
        return path;
    }
    public void setPath(String path) {
      

本文标签: 器中SpringBootpropertiesapplication