In a Spring bean, I need to process a configuration property before using is, e.g.:
@Component
class UsersController {
@Value("${roles}")
private String rolesAsString;
private List<String> roles;
@PostConstruct
public void initRoles() {
// just an example, not necessarily string splitting
roles = rolesAsString.split(",");
}
This works, but I am left with an unneeded member variable 'rolesString'. What would be a clean concise way to only keep the processed value?