IDEA not recognizing @Value annotation from Spring at all

Answered

I have a simple Service that is supposed to use a value from application.yml. This works fine when running the app and it's just fine inside the properties file. The one issue I am having, is that @Value does not provide any intelli-sense. It used to show the evaluated expression (the real value) right inside the code, but it does not anymore. I can't even click the expression to get to the properties file.

As you can see there are not context actions related to the annotation. I would expect this to show the real value from the config file, which Spring does recognize just fine. In application.yml:

Here is what I want. This is just a random screenshot from the forums, but I've had it working on different projects before:

Is there some config option for this? Folding doesn't work. It also doesn't work with built-in config properties like server.port. I get no auto-completion in @Value nor do I get the value of it.

2
3 comments

Works here:

 

Please make sure you have Settings (Preferences on macOS) | Editor | General | Code Folding | I18n strings option enabled. Also make sure you have the file located in folder marked as resources and Spring facet configured:

If problem remains, please provide a sample project.

0
Avatar
Permanently deleted user

It appears I have found the error. It is a bug though.

When using application.yml, the folding does not work. When using application.properties it works just fine.

0

Thank you for the information. Please vote for this issue in YouTrack: https://youtrack.jetbrains.com/issue/IDEA-251757

0

Please sign in to leave a comment.