spring-attic / spring-ide

Spring Development Environment for Eclipse
299 stars 126 forks source link

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

Closed youngm closed 4 years ago

youngm commented 4 years ago

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": []
}
youngm commented 4 years ago

Sorry wrong project. I'll recreate on correct project.