From spring boot official documentation (This is a highlight of the concept of creating custom spring boot variable) bellow you'll find a link to a Q/A that describes the solution.
Spring Boot jars are shipped with meta-data files that provide details
of all supported configuration properties. The files are designed to
allow IDE developers to offer contextual help and “code completion” as
users are working with application.properties or application.yml
files.
The majority of the meta-data file is generated automatically at
compile time by processing all items annotated with
@ConfigurationProperties. However, it is possible to write part of the
meta-data manually for corner cases or more advanced use cases.
Configuration meta-data files are located inside jars under
META-INF/spring-configuration-metadata.json They use a simple JSON
format with items categorized under either “groups” or “properties”
and additional values hint categorized under "hints":
Here is an example of a meta data config file :
{"groups": [
{
"name": "server",
"type": "org.springframework.boot.autoconfigure.web.ServerProperties",
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties"
},
{
"name": "spring.jpa.hibernate",
"type": "org.springframework.boot.autoconfigure.orm.jpa.JpaProperties$Hibernate",
"sourceType": "org.springframework.boot.autoconfigure.orm.jpa.JpaProperties",
"sourceMethod": "getHibernate()"
}
...
],"properties": [
{
"name": "server.port",
"type": "java.lang.Integer",
"sourceType": "org.springframework.boot.autoconfigure.web.ServerProperties"
},
{
"name": "spring.jpa.hibernate.ddl-auto",
"type": "java.lang.String",
"description": "DDL mode. This is actually a shortcut for the \"hibernate.hbm2ddl.auto\" property.",
"sourceType": "org.springframework.boot.autoconfigure.orm.jpa.JpaProperties$Hibernate"
}
...
],"hints": [
{
"name": "spring.jpa.hibernate.ddl-auto",
"values": [
{
"value": "none",
"description": "Disable DDL handling."
},
{
"value": "validate",
"description": "Validate the schema, make no changes to the database."
},
{
"value": "update",
"description": "Update the schema if necessary."
},
{
"value": "create",
"description": "Create the schema and destroy previous data."
},
{
"value": "create-drop",
"description": "Create and then destroy the schema at the end of the session."
}
]
}
]}
Each “property” is a configuration item that the user specifies with a
given value. For example server.port and server.servlet-path might be
specified in application.properties as follows:
server.port=9090 server.servlet-path=/home The “groups” are higher
level items that don’t themselves specify a value, but instead provide
a contextual grouping for properties. For example the server.port and
server.servlet-path properties are part of the server group.
Notes:
- The groups section is note required
- “hints” are additional information used to assist the user in configuring a given property. When configuring the spring.jpa.hibernate.ddl-auto property, a tool can use it to offer some auto-completion help for the none, validate, update, create and create-drop values.
You can easily generate your own configuration meta-data file from
items annotated with @ConfigurationProperties by using the
spring-boot-configuration-processor jar
You can check this Q/A
** for more details check the spring boot apendix section **