How to jump from java file to properties file

已回答

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.

1

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/.

0

It doesn't work, my other project is ok, I forgot how I configured it before.

0

Check the Spring facet configuration, make sure the context files are set correctly.

0

Yes It's work. I manual add the properties file to de Spring facet configuration. Thanks!!

0
Avatar
Permanently deleted user

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?

0

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.

0

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 .

0

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?

0
Avatar
Permanently deleted user

>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;
0

Sorry, we can't reproduce it, works just fine in 2020.2.3:

0

Note that IDE configures Spring facet automatically:

0
Avatar
Permanently deleted user

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)

0

请先登录再写评论。