Skip to content

spring ide not working with nested @ConstructorBinding when not an inner class #404

@youngm

Description

@youngm

Version: Spring IDE 4.5.0.RELEASE

I'm using Spring Boot 2.2.2 I have the following @ConfigurationProperties setup with @ConstructorBinding which works great during runtime but the IDE fails to auto complete. Any ideas?

package test;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;

@ConfigurationProperties(prefix = "someConfig")
public class ConfigProperties {

  @ConstructorBinding
  public ConfigProperties(NestedConfigProperties nested, NestedConfigProperties nested2) {}
}
package test;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;

@ConfigurationProperties
public class NestedConfigProperties {

  @ConstructorBinding
  public NestedConfigProperties(String dude) {}

  public String getBob() {
    return null;
  }

  public void setBob(String dude) {}
}

I would expect to see "dude" as an option. Instead I get an error.
image

Oddly enough the IDE seems to like bob in this case even though it doesn't exist in the configuration metadata.

This is what the configuration metadata looks like:

{
  "groups": [
    {
      "name": "",
      "type": "test.NestedConfigProperties",
      "sourceType": "test.NestedConfigProperties"
    },
    {
      "name": "someConfig",
      "type": "test.ConfigProperties",
      "sourceType": "test.ConfigProperties"
    }
  ],
  "properties": [
    {
      "name": "dude",
      "type": "java.lang.String",
      "sourceType": "test.NestedConfigProperties"
    },
    {
      "name": "someConfig.nested",
      "type": "test.NestedConfigProperties",
      "sourceType": "test.ConfigProperties"
    },
    {
      "name": "someConfig.nested2",
      "type": "test.NestedConfigProperties",
      "sourceType": "test.ConfigProperties"
    }
  ],
  "hints": []
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions