Overview

We noticed the value of the acceptedRoles changed.

With spring boot version 3.3.1 and before the size of the acceptedRoles list is 0, but after upgrading to 3.3.2 and above the value returned is 1.

TestController.java

@Value("#{T(java.util.Arrays).asList('${person.acceptedRoles}')}")
private List<String> acceptedRoles;

application.properties

person.acceptedRoles=

demo.zip

Comment From: sbrannen

Hi @prathmeshpethkar,

With spring boot version 3.3.1 and before the size of the acceptedRoles list is 0, but after upgrading to 3.3.2 and above the value returned is 1.

That has always been the expected behavior, since the equivalent code in Java (Arrays.asList("")) results in a List containing a single empty string.

In Spring Framework 6.1.11, we made changes to our handling of varargs method invocations in order to support that properly.

Assuming person.acceptedRoles can be either an empty string or a comma-separated list of roles (such as ADMIN,USER), the following SpEL expression will ensure that you get an empty list or a list of the individual strings, respectively.

@Value("#{'${person.acceptedRoles}'.length > 0 ? '${person.acceptedRoles}'.split(',') : {}}")
List<String> acceptedRoles;

Please let us know if that works for you.

Thanks,

Sam

Comment From: prathmeshpethkar

Thanks Sam