How to jump from java file to properties file
Answered
I use the Value annotation and when I click on the annotation, I am prompted to "cannot find delaration to go to" instead of jumping to the resource file.
Please sign in to leave a comment.
GoTo key inside @Value should navigate to the property location. Try F4 or Ctrl+B or Ctrl+Click.
If it doesn't work for you, please share a sample project: https://uploads.services.jetbrains.com/.
It doesn't work, my other project is ok, I forgot how I configured it before.
Check the Spring facet configuration, make sure the context files are set correctly.
Yes It's work. I manual add the properties file to de Spring facet configuration. Thanks!!
Hi! I have the same problem.
I imported a tutorial project like https://github.com/spring-guides/gs-uploading-files.git
the opened via pom.xml in Intellij IDEA:
IntelliJ IDEA 2020.2.3 (Ultimate Edition)
Build #IU-202.7660.26, built on October 6, 2020
Now I am trying to jump from a java class to the props file
@Value("${spring.servlet.multipart.max-file-size}")
private String size;
but get "cannot find delaration to go to".
What is misconfigured?
The project linked doesn't have this specific Java code.
I've tried to add it to the controller class and jumping works as expected.
Please provide a complete project to reproduce the problem and share a video showing how to reproduce the issue.
Well I just added these lines to the main class https://github.com/spring-guides/tut-spring-boot-kotlin/blob/master/src/main/kotlin/com/example/blog/BlogApplication.kt
But I also tried with another project https://github.com/spring-guides/issue-aggregator where necessary fields are presented:
https://github.com/spring-guides/issue-aggregator/blob/9f11ce6f92e4db2b72e5495736a432711f1d8831/src/main/kotlin/io/spring/guides/issueaggregator/IssueAggregatorApplication.kt#L73
PS. I am importing the projects as maven/gradle, do I need addition Facets setup?
Java and Kotlin may work differently here. The first project linked doesn't have any Kotlin code.
Does the issue occur only with Kotlin?
Please zip and share the complete project to reproduce and upload it at https://uploads.jetbrains.com .
For the https://github.com/spring-guides/issue-aggregator project these properties references from the .kt file are not defined anywhere. Where do you expect the navigation to work?
>these properties references from the .kt file are not defined anywhere
Yes, you are right, but using ones from resources lead me the same behavior
Please take a look at:
Upload id: 2020_10_10_Xqvq1K78Te6wG52u (file: gs-actuator-service.zip)
Just another tutorial project with resources and I manually modified the main class with
@Value("${server.port}")private String serverPort;
Sorry, we can't reproduce it, works just fine in 2020.2.3:
Note that IDE configures Spring facet automatically:
Well... Thank you.
With the same setup of the Modules at the last screen I have navigation works, too!
But I had to add the "additional properties" manually, it never appeared before by import / restart w/clean ...
BTW I use macOS 10.15.4 (19E287)