Skip to content

spring-configuration-metadata : must have primitive type property before F3 navigation works #1030

Closed

Description

@space88man

Describe the bug
When a @ConfigurationProperties does not have a field that is a primitive type it will not navigate with F3.

The root and child don't navigate with F3 and get The operation is not applicable to the current selection. The grandchild works as it has fields that are primitive type.

To Reproduce

app: # no primitive type field at all
  service1: # no primitive type field at all
    service: # this navigates
      host: 1.2.3.4
      port: 5000

package com.example.demo;

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

@ConfigurationProperties(prefix = "app")
public class Settings {
    public static record Endpoint(String host, int port) {}
    public static record Service(Endpoint service) {}
    
    
    private Service service1;
    public Service getService1() {
        return service1;
    }
    public void setService1(Service service1) {
        this.service1 = service1;
    }
}

CAN'T navigate with F3: app, app.service1
CAN navigate with F3: app.service1.service

Sample

gh-sts4-sampleV2.zip

Activity

  1. changed the title [-]spring-configuration-metadata is not navigating with F3 in STS 4.18.0[/-] [+]spring-configuration-metadata+Java 17 record is not navigating with F3 in STS 4.18.0[/+] on Apr 26, 2023
  2. changed the title [-]spring-configuration-metadata+Java 17 record is not navigating with F3 in STS 4.18.0[/-] [+]spring-configuration-metadata : must have primitive type property before F3 navigation works[/+] on Apr 26, 2023
  3. space88man commented on Apr 26, 2023

    @space88man
    Author

    Add a dummy field that is a primitive type makes F3 navigation work:

    # this application.yml file will navigate correctly using F3
    app2:
      value: true
      service1:
        value: true
        service:
          host: 1.2.3.4
          port: 5000
    
    @ConfigurationProperties(prefix = "app2")
    public class Settings2 {
    
        public static class Endpoint {
            private String host;
            private int port;
            public String getHost() {
                return host;
            }
            public void setHost(String host) {
                this.host = host;
            }
            public int getPort() {
                return port;
            }
            public void setPort(int port) {
                this.port = port;
            }
            
        }
        public static class Service {
            private Endpoint service;
            private boolean value;
            public Endpoint getService() {
                return service;
            }
            public void setService(Endpoint service) {
                this.service = service;
            }
            public boolean isValue() {
                return value;
            }
            public void setValue(boolean value) {
                this.value = value;
            }
        }
    
    
        private Service service1;
        private boolean value;
    
        public Service getService1() {
            return service1;
        }
    
    
        public void setService1(Service service1) {
            this.service1 = service1;
        }
    
    
        public boolean isValue() {
            return value;
        }
    
    
        public void setValue(boolean value) {
            this.value = value;
        }
    }
    
  4. self-assigned this
    on Apr 26, 2023
  5. added this to the 4.18.1.RELEASE milestone on Apr 26, 2023
  6. BoykoAlex commented on Apr 27, 2023

    @BoykoAlex
    Contributor

    Fixed with e9b7518 (and two commits above it)
    Update from the nightly build. Find appropriate p2 repo here: https://dist.springsource.com/snapshot/STS4/nightly-distributions.html (see STS4 Distribution section at the top of the page)
    The snapshot build should be available Apr 27 AM hours EST

  7. BoykoAlex commented on Apr 27, 2023

    @BoykoAlex
    Contributor

    @space88man Almost forgot... Thanks very much for taking the time to investigate the issue, providing great description and assembling a test project for this issue. Much appreciated by all of us on our end. We have included you test projects with use cases in our unit tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions