0

The code below, I need to convert them to @Value Annotations, But the difficult part of it is that I have to split the @Value after I split it once. As you can see I created a @Value annotation for APP_COMMAND and split it with delimiter '@!', and named it String[] appCommandArray; I want to be able to split appCommandArray again using the same idea but this time with delimiter of ',', But can you do @Value annotations on a variable? or does it has to come from a properties file?

Value Annotations

 @Value("#{'${APP_COMMAND}'.split('@!')}") 
 private String[] appCommandArray;      
 @Value("#{'${APP_THRESHOLD_VALUE_CRITICAL_HIGH}'.split('@!')}") 
 private String[] criticalThresholdArray;

How to convert this

    String[] commandArray=appCommandArray[j].split(",");
    String[] commandCriticalArray=criticalThresholdArray[j].split(",");

Application Properties

APP_COMMAND = test@!test@!test@!sleep@!sleep@!sleep@!foo,bar@!foo,bar@!foo,bar@!test@!test@!test@!sleep@!sleep@!foo,bar@!hello,world@!hello,world@!sleep

The script is splitting the values again. I am not asking on how to display my @value annotations, I am asking on how can I split an @value annotation once it's already been split

JayC
  • 2,144
  • 8
  • 42
  • 77

0 Answers0