apache / apache/grails-intellij-plugin
IDEA cannot infer types of autowired beans in grails 3 app
- Dominant language
- Java
- Stars
- 17
- Forks
- 4
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 4
Description
Hi!
A few details:
I'm using grails 3 (3.0.14) and IDEA 15.0.3. Source code is, for example:
```
class BootStrap {
def cardService
def init = { servletContext ->
cardService.importAllCards()
}
}
```
A long time ago in a galaxy far far away, IDEA was handling that perfectly. I used grails 2 and IDEA 14 during these happy days. What do I mean by saying "perfectly"? Well, I could hover mouse to the "cardService" word and click Ctrl, and then I would see it's "CardService" class. I also seen a green leaf near the "def cardService". Now I see "private def cardService" and "Cannot infer type". I was able to Ctrl+Click the "importAllCards" and see the source code of that method. Right now it's impossible, too.
It works fairly well when I use
```
class BootStrap {
@Autowired
CardService cardService
def init = { servletContext ->
cardService.importAllCards()
}
}
```
But I just think Grails support can be improved.
Controllers and services share the same behaviour.
---
*Imported from [IDEA-151571](https://youtrack.jetbrains.com/issue/IDEA-151571) · Type: Bug · Votes: 0*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue in the Grails 3.0.14 and IDEA 15.0.3 setup using the BootStrap example, then compare unannotated and @Autowired CardService fields. Check whether type inference and Ctrl+Click navigation work for injected services in BootStrap, controllers, and services; done means the unannotated form resolves the service type and method source.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100