-
Notifications
You must be signed in to change notification settings - Fork 42
Configuration Properties Editor
The plugin recognizes Spring Boot configuration properties files and opens them in a specific editor.
Recognized file name patterns are:
-
application.properties
andapplication-<profile>.properties
-
bootstrap.properties
andbootstrap-<profile>.properties
The configuration properties file editor has an extended syntax highlighting, configurable error highlighting and provides completion for configuration properties names and values together with documentation. Completion proposals and their documentation are obtained by processing Spring Boot configuration metadata. That metadata is embedded in Spring Boot jars and can be generated for user code by the spring-configuration-processor
(see below).
The extended syntax highlighting colorizes dot separated keys and key array notation.
You can configure colors choosing Tools > Options and selecting in the Fonts & Colors tab the Spring Boot Configuration Properties language:
Error annotations can be disabled and severity configured in the global plugin options. By default the following annotations are shown:
- syntax errors: such as wrong array notation, misplaced comments, unescaped special characters.
Note: contrary to standard Java Properties notation, where keys can be separated from values by whitespace, the configuration editor flags as syntax error the absence of a :
or =
separator.
- duplicates: repeating properties are flagged, by default, as warnings.
- data type mismatches: configuration properties values are checked against the data type declared in the metadata and if the value string cannot be converted it is flagged as an error.
Note: data type mismatch only supports the most common data type conversions (for instance does not detect and make use of Spring converters declared in the project), if you think some important data type conversion is missing open an enhancement issue.
- unknown properties: configuration properties for which there is no metadata are flagged, by default, as warnings.
Properties names are completed trough a substring search. Data type and documentation of the currently selected property in the completion list is shown.
Property values from the hints
attribute in spring configuration metadata are completed when completion is invoked after an equal sign.
If the spring-configuration-processor
has been added as a maven dependency to the project, for example trough the maven code generator provided by the plugin, Spring Boot configuration properties metadata is also generated for @ConfigurationProperties
classes in the project and used to provide completion and documentation for user defined properties.
Note: If you modify a @ConfigurationProperties
class you should rebuild the project to let the editor pick up the newly generated configuration properties metadata.
To provide lists of allowed values for user defined properties use the Additional Properties Metadata file template.