Skip to content

@ConfigurationProperties with Map does not work in native executable #33722

@sogmemu

Description

@sogmemu

Hi,

in an application wie use a ConfigurationProperties class wich contains an HashMap.
If this application runs as "normal" java application everything works find.
But as soon as this application is build as native executable, the Hashmap is not filled anymore.

I created a test application

We used this properties class:

@Validated
@Data
@Component
@ConfigurationProperties(prefix = "test-props")
@FieldDefaults(level = AccessLevel.PRIVATE)
public class TestProperties {

    @NotEmpty
    HashMap<String, PermissionsConfig> datagroups;

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    @FieldDefaults(level = AccessLevel.PRIVATE)
    public static class PermissionsConfig {
      // fields
    }
}

With this application.yml

test-props:
  datagroups:
    data:
      read:
        code: READ_DATA
        urlPattern:
          - /some/pattern/

I added an extra hint for the native image build. Without this hint the validation does not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: 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