Please look at example code:
public static class MyTestClass {
public List<Boolean> booleans = new ArrayList<>();
}
public static void main(String[] args) {
SpelParserConfiguration config = new SpelParserConfiguration(true, true);
MyTestClass myTestClass = new MyTestClass();
SpelExpressionParser parser = new SpelExpressionParser(config);
Object value = parser.parseExpression("booleans[1]").getValue(myTestClass); //exception
I try to initalize boolean list with default values. The problem is, Boolean class does not have default constructor so I got exception:
Caused by: java.lang.NoSuchMethodException: java.lang.Boolean.<init>()
It is possible to write how new objects should be initalized if they dont exists in list?