Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-1908

Do not use Javadoc tags in Spring Boot configuration keys description

    XMLWordPrintable

Details

    • 2020 Week 10-12 (from Mar 2), 2020 Week 13-15 (from Mar 23)
    • 1
    • NEW
    • NEW

    Description

      IDEs with Spring Boot support read configuration hints for application.properties from a metadata JSON file distributed in the auto-configuration module. They don't read Java sources of the configuration classes so Javadoc tags like @link or @value are not processed in any way.

      Example

      If we have this in optaplanner-spring-boot-autoconfigure module:

      OptaPlannerProperties.java
      @ConfigurationProperties(value = "optaplanner", ignoreUnknownFields = false)
      public class OptaPlannerProperties {
      
          public static final String DEFAULT_SOLVER_CONFIG_URL = "solverConfig.xml";
      
          /**
           * A classpath resource to read the solver configuration XML.
           * Defaults to {@value DEFAULT_SOLVER_CONFIG_URL}.
           * If this property isn't specified, that solverConfig.xml is optional.
           */
          private String solverConfigXml;
      
          // code omitted
      }
      

      then metadata will contain

      target/classes/META-INF/spring-configuration-metadata.json
      {
        // ...
        "properties": [
          {
            "name": "optaplanner.solver-config-xml",
            "type": "java.lang.String",
            "description": "A classpath resource to read the solver configuration XML. Defaults to {@value DEFAULT_SOLVER_CONFIG_URL}. If this property isn't specified, that solverConfig.xml is optional.",
            "sourceType": "org.optaplanner.spring.boot.autoconfigure.OptaPlannerProperties"
          }
          // ...
        ]
        // ...
      }
      

      which will be displayed like this in IntelliJ IDEA:

      Attachments

        Activity

          People

            jlocker Jiří Locker
            jlocker Jiří Locker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: