0

I have created a simple micronaut project using mn cli and followed the steps to generate eclipse project (using gradlew eclipse )

Everything looks fine however when I create any service and annotate with @Singleton annotation, Eclipse gives the error for following import statement, import javax.inject.Singleton

enter image description here

The error is The import javax.inject.Singleton cannot be resolved

However if I use the wildcard import like,

enter image description here

No issues reported by Eclipse.

Please note that despite Eclipse showing the error, the project builds and runs perfectly fine from command line using gradlew run

However it's a hinderance in case if I want to debug the code.

It must be something to do with Eclipse JDT compiler, but I can't figure out.

Any help is appreciated !

jatanp
  • 3,982
  • 4
  • 40
  • 46
  • If you hover the mouse over `@Singleton` in the wildcard case what does the pop-up say the full type is? If you press F3 (Open Declaration) with `@Singleton` selected what does it open? – greg-449 Aug 21 '21 at 16:44
  • It is opening public @interface Singleton {} inside javax.inject-1.jar – jatanp Aug 21 '21 at 17:12
  • Surprisingly javax.inject.Inject works perfectly fine, which is a sibling interface of Singleton – jatanp Aug 21 '21 at 17:13

0 Answers0