im working in java project where i have a map of exception that will be used in spring retryTemplate. this is my Map :
Map<Class<? extends Throwable>, Boolean> exceptionMap = new HashMap<>();
// list exception to trigger retry
exceptionMap.put(IllegalArgumentException.class, true);
exceptionMap.put(TimeoutException.class, true);
exceptionMap.put(RuntimeException.class, true);
exceptionMap.put(TopicAuthorizationException.class, true);
exceptionMap.put(MemberIdRequiredException.class, true);
my issue is that i don't know the exact exception class so i want to load the list dynamically from properties file. this is my property :
myapp.exception.class=TimeoutException,RuntimeException,TopicAuthorizationException,MemberIdRequiredException
i load my property in my class :
@Value("${myapp.exception.class}")
private String myclassesList;
do you have any idea please on how i can get the values from my properties and put each element in my Map.
Thanks in advance.
Regards