spring cloud config documentation and completion
Answered
Hi,
I have a Spring cloud config project. The project contain only yalm files and no pom.xml. I added that sub project in another one as a module (File -> Project Structure -> Modules -> + Add -> Import Module -> Create module from existing source) There is no framework support detected.
So I'm not able tu use the autocompletion neither to see the documentaion with Ctrl+Q
Is is possible to benefits of these features and how ?
I use Intelij Idea ultimate last version.
Please sign in to leave a comment.
It is needed to connect Spring libraries to your project. That could be done in module settings (https://i.imgur.com/ZHIjpvE.png)
Thanks for you Answer.
Unfortunatly with the way I imported the module, I don't see the differents tabs of your printscreen. There is no code in that module, a bogus pom.xml, just yaml files.
Here is how it appears in the Project Panel.
Hello,
Try to re-import the project after removing ".idea" folder inside.
I don't have any .idea inside the folder juste a .iml
@Monsio B
The folder is invisible by default.
Please try to remove it from cmd:
My bad ! the .idea was in the main folder that contains all my modules (one folder per module or microservice).
I gave another name to the .idea like ._idea to test but I get the same result when I add the folder containing the spring cloud config sub project as a module.
The fact is there are no code in that project just config files...
Instead of importing from the existing sources add a new Java module manually with the content and source roots configured per https://www.jetbrains.com/help/idea/configuring-content-roots.html.
Thanks of your answer.
I created a new Java module but I still don't have access to autocompletion or documentation for the properties in the yalm files.
I have access to these features with the other modules where the config files are located into src/main /resources/application.yml.
But with that module not containing any code just config files directly under the project root, it doesn't work.
On the other modules when I use ctrl+space the app suggest me properties keys or values and ctrl+Q give me the documentation of a property if it exists. That is all I need.
See https://www.jetbrains.com/help/idea/spring-support.html#add-spring-modules . You need to add Spring support and configure the application context.
Ok I added the spring framework support so now the leaf with Spring appear under the module name. But it doesn't seem to change anything.
I put some printscreens of my config module and some of another module that works fine.
Here is the spring facet for my config-repo module.
When I edit the context and clic on +, I can only choose the 'Other Files' option to select the files. But it doesn't work anyway.
Here another facet that works fine for the config-server module. I have the property file called 'application.yml under 'Configuration files'.
Other screenshot of the two modules. config-repo first
And the config-server module.
Application context is different for these modules, make sure it includes the yml files and other configurations you are using.
I think the problem is that the config-repo module is not really a Spring boot applictation. Actually it just contains config files store on a Git repository.
This repository is used by the config-server application to deliver the configuration at startup to the other microservices.
So the IDE do not recognise that module as a Spring boot project even if I have a spring facet I don't know how to force the IDE to do that.
Like I said before all I can do with that module is add Other files. If I choose "additionnal properties" files the ylm files don't even appear...
The problem is that I don't have the spring boot button in the Facet configuration window as below.
Maybe the only way is to create a bogus spring boot project but it looks like hacking ...
This feature really depends on Spring support and will not work outside of the real Spring module.
I created a spring boot bogus project with spring initializer and added the generated content into the config-repo module folder.
Then I imported the module from an external model choosing Maven.
Now I have the ability to add the yalm files and they are weel recognise as spring boot config files.
The autocompletion and the documentation are available.
Till I found a better solution, if there is one, this one does the job ...