Evaluating Spring @Value annotation as primitive boolean

Its an old thread but if you still want to inject Non-String values using @Value Spring annotation, do this:

@Value("#{new Boolean('${item.priceFactor}')}")
private Boolean itemFactorBoolean;

@Value("#{new Integer('${item.priceFactor}')}")
private Integer itemFactorInteger;

Works for me on Spring boot 1.5.9 with Java 8.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)