0

I'm unable to get lists to autocomplete when writing configuration files. Standard objects work as expected.

I've configured both classes as properties:

@SpringBootApplication
@EnableConfigurationProperties(value = {AppProperties.class, EncoderProperties.class})
public class Application {

  public static void main(final String[] args) {

    SpringApplication.run(Application.class, args);
  }
}

The root of my configuration

@Data
@AllArgsConstructor
@NoArgsConstructor
@ConfigurationProperties("application")
public class AppProperties {

  private String scanTarget;

  private List<EncoderProperties> encoders;
}

Finally, the encoders object

@Data
@AllArgsConstructor
@NoArgsConstructor
@ConfigurationProperties("application.encoders")
public class EncoderProperties {

  private String name;

  private String command;

  private String outputExtension;
}

When I try and autocomplete the configuration in the application.yaml file, IntelliJ is seeing it as a nested property, not a list

enter image description here

I've cleaned and built the project a number of times but still unable to get it registering as a list.

What I'm expecting is to be able to add a list of encoders to the application root.

Any suggestions where I've missed something?

Occlumency
  • 149
  • 2
  • 9
Chris
  • 3,437
  • 6
  • 40
  • 73

2 Answers2

0

You will always see it as properties but, it will get applied as yaml. The reason you see it as properties, is so that you get to see the depth of that particular configuration.

Occlumency
  • 149
  • 2
  • 9
  • I'm unable to apply it as a list, IntelliJ will "autocorrect" out of a list when I try, erasing what I had manually entered. – Chris Mar 12 '21 at 11:54
  • @ChrisTurner humor me on this.. The annotationProcessor is not dynamic in intellij. There is a file called spring-configuration-metadata.json which is generated in the build/classes/META-INF/spr...json.. To see your latest changes, trigger a clean/build and try your configuration again. I don't see anything wrong with your configuration. – Occlumency Mar 12 '21 at 12:30
  • @ChrisTurner did the steps above help you? – Occlumency Apr 05 '21 at 12:52