Skip to content

Method not found in Spel expression in native images #34206

@ghost

Description

Using Spel and emptyList() seems to fail in the native image. This method exists in Collections however in the native image it could not be found. Is there any workaround? Is even calling methods allowed in Spel expressions in Spring native? Thank you.

@Configuration
@ConfigurationProperties(prefix = "test")
@Data
public class TestConfiguration {

    @Value("${test.aaa : #{T(java.util.Collections).emptyList()}}")
    private List<String> aaa;
EL1004E: Method call: Method emptyList() cannot be found on type java.util.Collections

EmptyList is defined as following:

public class Collections {
...
public static final <T> List<T> emptyList() {
        return (List<T>) EMPTY_LIST;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions