首页 > 解决方案 > Spring Dataflow 不显示属性

问题描述

当我在 Spring Cloud 中创建任务Dataflow并在 Spring Cloud 仪表板中编辑属性时,尽管已配置 ,但Dataflow我只看到标准属性。而且我不知道我设置错了什么。代码下方。labelConfigurationProperties

工作道具:

@Component
@ConfigurationProperties("job")
public class JobProps {

    private String ux;
//getter and setter
}

工作:

@Component
public class JobDoing {

    public JobDoing() {
        doing();
    }

    @Value("${job.ux:}")
    private String test;

    private static final Log logger = LogFactory.getLog(JobConfiguration.class);

    public void doing(){
            logger.info("Props: " + test);
    }
}

演示应用:

@EnableConfigurationProperties({JobProps.class })
@EnableTask
@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}

标签: spring-cloud-dataflowspring-properties

解决方案


您需要将应用程序的自定义配置属性列入白名单,以便在提取和显示应用程序配置属性时它们被 Spring Cloud Data Flow 服务器拾取。

要将配置属性列入白名单,您可以参考文档。


推荐阅读