YAML Autocomplete from enum Intellij - spring-boot

I have YAML file that has a list, the values allowed in that list are defined in an Enum in that project.
Is there anyway I can help the user with autocompletion when opening the file in intellij? I know Spring boot to do this in some way.

Such auto completion is currently not provided in YAML configuration files, but .properties files only. Please watch https://youtrack.jetbrains.com/issue/IDEA-151708 for progress.

Related

How can I set isolation-level-for-create via yaml configuration file for spring batch

I found a solution to do it via Java code here:
https://docs.spring.io/spring-batch/docs/4.2.x/reference/html/job.html#configuringJobRepository
But, I want to do it if possible in a simple way via configuration in yaml format in the batch configuration file.
Thank you.
As far as I know, there is currently no such property in yaml available.
There is an open feature request in Spring Boot (https://github.com/spring-projects/spring-boot/issues/28802) that may result in a property like spring.batch.jdbc.isolation-level-for-create in the future. Until then, you'll need to use Java (or XML) configuration.

How to chnage properties file and dependancy dynamically in spring boot

i want to create an functionality in which i have to change the dependancy in POM file and properties file dynamically.
You need to elaborate more on the requirements and put more info on what you're trying to achieve.
You can use Maven profiles to change dependencies dynamically. Reference Link also Similar Solution
For properties file, follow these Reference Link also Similar Solution

How can I create documentation with all properties which can be overridden in `yaml` file of my spring boot application?

Can I generate documentation from spring-configuration-metadata.json file?
I have autogenerated file spring-configuration-metadata.json with properties. It's useful for autocomplete in IDE. But I wont to give documentation to administrators. I can give them JSON file, but maybe there is something which can convert JSON to HTML or something else?
I just want to create full list properties which can be overridden in yaml file and pass it to somebody who deploys an application.

Can Spring IDE support editing multiple application.yml files?

I'm using Eclipse Neon with Spring IDE Version 3.8.3.201612191259-RELEASE.
Whenever I create an application.yml file under src/main/resources it shows with a Spring embellished icon and allows me to see Spring Boot's configuration (for example see here: https://docs.spring.io/sts/nan/v370/NewAndNoteworthy.html).
For different profiles developers can either use a single YAML file with different sections for each spring.profiles via the --- notation. Developers might also choose to use separate YAML files named with the profile as part of the name (i.e. application-dev.yml) as noted in this link: https://www.mkyong.com/spring-boot/spring-boot-profile-based-properties-and-yaml-example/ .
The functionality provided by the Spring Boot YML Editor is very helpful not only for YAML editing but also because it allows auto-complete for Spring Boot's configuration. Is there a way to associate more than one file to be see by the Spring Boot YML Editor so that I can easily edit files like application-dev.yml in that editor? I know I can right-click on the file and have it open-with Spring Yaml Properties Editor but it would be nice if similar to configuring the Spring Bean support Config Files you could also pick multiple files to be seen as Spring YAML files (or perhaps look for all application-XXX.yml files and associate them to the editor).
The place where to specify file associations for the content type Spring Yaml Properties File can be found in the Eclipse preferences in General > Content Types. Search for the content type Yaml Content Type > Spring Yaml Properties File. In the box below you can add your required file associations.
As of Eclipse Neon you have to specify all your variants, e.g. application-prod.yml, application-some-profile.yml, ...
In Eclipse Photon it will be possible to use wildcards, e.g. application-*.yml. See https://www.eclipse.org/eclipse/news/4.8/M2/ for details

File Set Not Configured For The File Intellij IDEA

When I open a Spring configuration files at my application on Intellij IDEA sometimes it says
File Set Not Configured For The File
and gives me a link
Configure File Set
When I click it it says:
MVC dispatcher servlet
Create New File Set
or opens a new window cnd let me check some files.
What happens when I click them and what is this for? I click MVC dispatcher Servlet and check the code but doesn't see any changes.
What it is for?
this is for IDEA to help you out with dependencies between different files.
For example you have "service-spring-config.xml" and "mvc-spring-config.xml", where the MVC config uses some beans from the Service config. If you add these both files to the "File Set", IDEA will know that these two files represent a single application context.
By knowing that, it will help you autocomplete beans in XML + will inform you if something is not resolvable without you having to actually run the app.
I click MVC dispatcher Servlet and check the code but don't see any changes
This is because you only have a single file (for now). Later on, you can add some other configs that use/reference beans from each other => then it'll become REALLY helpful
From IDEA File Sets documentation:
By combining Spring XML configuration files in a file set you tell IntelliJ IDEA that these files are mutually related. In this way you form a common editing context for these configuration files and get all the associated coding assistance.
Spring file sets on IntelliJ are for grouping related files.
IntelliJ could autodetect some of this groups, for example files that are loaded with ContextLoaderListener on web.xml or default files for DispatcherServlet (That seems to be your case)
When IntelliJ asks to configure a File Set for a Spring file, is 'cause IntelliJ couldn't detect a default way to include in a group, for example files that are loaded within the ApplicationContext's constructor Ex:
new ClasspathXmlApplicationContext("somefile.xml","anotherfile.xml");
When file sets are correctly configured IntelliJ could bring many goodies like auto-complete, navigation, validation, dependency graphs and others

Resources