storm初始化Bolt实例,spring bean绑定失败原因排查

时间:2021-03-15 17:31:12
 
public static final String METRICS_AGGREGATE_PERIOD_MILLISECONDS = "metrics.storm.aggregate.period.milliseconds";
    @Value("${" + METRICS_AGGREGATE_PERIOD_MILLISECONDS + "}")
    private long metricsAggregateIntervalMilliSeconds;
上面这样书写,Bolt实例化后metricsAggregateIntervalMilliSeconds的值为null

 

public static final String METRICS_AGGREGATE_PERIOD_MILLISECONDS = "metrics.storm.aggregate.period.milliseconds";
    @Value("${" + METRICS_AGGREGATE_PERIOD_MILLISECONDS + "}")
    private transient long metricsAggregateIntervalMilliSeconds;

 

上面这样写,Bolt实例化后metricsAggregateIntervalMilliSeconds的值为0

 

public static final String METRICS_AGGREGATE_PERIOD_MILLISECONDS = "metrics.storm.aggregate.period.milliseconds";
    @Value("${" + METRICS_AGGREGATE_PERIOD_MILLISECONDS + "}")
    private long metricsAggregateIntervalMilliSeconds;

这样写就正常了.

原因未知,先记上,稍后排查.