6.2 Sling model Inject annotation

Avatar

Avatar

Sutty100

Avatar

Sutty100

Sutty100

13-06-2016

I've just updated from 6.1 to 6.2 and suddenly my sling models are causing problems. It seems like javax.inject is no longer available and so my bundle wont start. I have tried adding to my top level pom a dependancy but it is still not happy.

Error:

javax.inject,version=[0.0,1) -- Cannot be resolved

Dependancy added:

            <dependency>

                <groupId>javax.inject</groupId>

                <artifactId>javax.inject</artifactId>

            </dependency>

View Entire Topic

Avatar

Avatar

Jaggu_Accenture

Avatar

Jaggu_Accenture

Jaggu_Accenture

22-01-2018

I got the solutions, please find add the below code in core pom.xml file(i.e. find <instructions> and next to add <Import-Package>javax.inject;version=0.0.0,*</Import-Package>). The below solutions is required because in aem 6.2 default javax.inject is there so we just need to import this.

<instructions>

<Import-Package>javax.inject;version=0.0.0,*</Import-Package>

Capture.PNG