'Reading values from app propertis and check if contains?

I have this in my app propertis:

deactivate.setup ={'user_deleted','user_deactivated','admin_deleted','admin_deactivated'}

This is how i read properties:

@Value("${deactivate.setup}")
private List<String> deactivate;

But when i use this it always return false:

if(deactivate.contains(getCode(resource))){}

Any suggestion?



Solution 1:[1]

You need to change the value of deactivate.setup in the application properties.

In your case, the list values are as below

enter image description here

As you can see { and ' characters are in the list. So change deactivate.setup value with user_deleted,user_deactivated,admin_deleted,admin_deactivated.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 oktaykcr