Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM 6.3: Felix SCR Annotations Deprecated - Replacement for @SlingFilter?

Avatar

Avatar
Validate 1
Level 2
timlwhite
Level 2

Likes

9 likes

Total Posts

32 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
timlwhite
Level 2

Likes

9 likes

Total Posts

32 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
timlwhite
Level 2

24-05-2017

Hello, it appears that the Felix SCR annotations have been deprecated in AEM 6.3.  This is not reflected on the Sling website or documentation as far as I can tell, but is appearing that way when we compile against the 6.3 uberjar.

In fact, the latest AEM Maven Archetype does not include the Felix SCR dependency at all.

I see this blog post from last year that covers a lot of conversion questions.

And this very recent one from Feike.

The OSGi 6 method for registering configuration properties using a separate interface class is fairly convoluted, and thinly documented, but with enough time and money I am sure we can figure it out.

However, there does not seem to be mention in either article of what is replacing the @SlingFilter annotation, which is mentioned as the recommended approach even in fairly recent articles.

All our classes that use the @SlingFilter annotation no longer work (they are throwing ArrayIndexOutOfBounds exceptions), even keeping the Felix SCR dependency, and updating it to the latest version.

Is there documentation somewhere of what is replacing the @SlingFilter annotation?

Is there a plan for a more complete document describing the recommended migration path, and changes to the product that cause existing @SlingFilter usage not to work?

Thanks!

Tim

desktop_exl_promo_600x100_weknowyou.png

View Entire Topic

Avatar

Avatar
Validate 1
Level 2
cmr96960454
Level 2

Likes

3 likes

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile

Avatar
Validate 1
Level 2
cmr96960454
Level 2

Likes

3 likes

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile
cmr96960454
Level 2

17-04-2018

import com.icfolson.aem.library.core.services.OsgiConfiguration

import com.ingredion.aem.core.services.EloquaService

import com.ingredion.aem.core.services.EloquaServiceUS

import com.ingredion.aem.core.services.SalesforceService

import org.apache.felix.scr.annotations.Activate
import org.apache.felix.scr.annotations.Component
import org.apache.felix.scr.annotations.Modified
import org.apache.felix.scr.annotations.Property
import org.apache.felix.scr.annotations.Service


@Component(label = "Ingredion Eloqua Connector Service For US", metatype = true)

@Service(EloquaServiceUS)

class DefaultEloquaServiceUS implements EloquaServiceUS

{

   private static final String DEFAULT_URL = "https://s2141011786.t.eloqua.com/e/f2"
   private static final String DEFAULT_ELQ_SITE_ID = "2141011786"

   @Property(label = "Eloqua URL", description = "Eloqua Url",

  value = DefaultEloquaServiceUS.DEFAULT_URL)

   private static final String URL = "url"

   @Property(label = "Eloqua Site ID", description = "This ID will tell Eloqua that the request is coming from Ingredion",

  value = DefaultEloquaServiceUS.DEFAULT_ELQ_SITE_ID)

   private static final String ELQ_SITE_ID = "elqSiteId"

   String url

   String elqSiteId

   @Activate
  @Modified
   void activate(Map<String, Object> properties) {

   def configuration = new OsgiConfiguration(properties)

   url = configuration.getAsString(URL, DEFAULT_URL)

   elqSiteId = configuration.getAsString(ELQ_SITE_ID, DEFAULT_ELQ_SITE_ID)

  }

}

This is my code and this was written in groovy.

Now we are upgrading to aem 6.3 from 6.1.

@Activate, @Modified, @Component, @Service is dericated.

So i replaced with osgi annotations.

But not sure how to replace below lines.

@Property(label = "Eloqua URL", description = "Eloqua Url",

  value = DefaultEloquaServiceUS.DEFAULT_URL)

   private static final String URL = "url"

  

Can anyone suggest me how to replace @Property?