I met a issue,I try to listen to EnvironmentChangeEvent and re-init some configuration, while i found that @Value annotation with SpEL is not working, but plain @Value annotation is OK:
@Component
public class ConsumeService {
@Autowired
ConsumeConfig consumeConfig;
@EventListener(EnvironmentChangeEvent.class)
void onEnvChange() {
log.debug("{}",consumeConfig);
//when i print here, i get only consumeDesc, but cardList is an empty List.
}
}
@Configuration
@RefreshScope
public class ConsumeConfig {
@Value("${consume.desc}")
private String consumeDesc;
@Value("#{'${api.server.round.card}'.split(',')}")
private List<String> cardList;
}
Question:
Is this issue related with lifecycle of SpEL? It seems that, the value of SpEL is not yet parsed.
Comment From: spencergibb
We have only ever documented that placeholders ${}
work, not SpEL.
Comment From: kevinho
I get it. Hope to support SpEL next.
Comment From: zacisco
@marcingrzejszczak, @spencergibb
We have only ever documented that placeholders ${} work, not SpEL.
Hello why you still don't want support SpEL in Cloud Server?