Expand my Community achievements bar.

SOLVED

OSGI R6 configuration and the Felix SCR configuration can be used in a single project?

Avatar

Level 3

Can I use both Felix SCR annotation, OSGI R6 annotations in a single project??  I think answer is yes. But wanted to confirm from others. - Thank in advance.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @gmahesh ,

It depends on your project archetype and AEM version - OSGI DS annotations are recommended over SCR annotations starting 6.2+. 

However, You can mix SCR annotations and OSGI annotations in a project, you don’t need to migrate them all at once. But you can to be consistent on a class level, you cannot mix SCR and OSGI annotations in a single class. This is achieved by an extension to the maven-bundle-plugin.

In short, answering your question is YES!

Hope that helps!

Regards,

Santosh

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @gmahesh ,

It depends on your project archetype and AEM version - OSGI DS annotations are recommended over SCR annotations starting 6.2+. 

However, You can mix SCR annotations and OSGI annotations in a project, you don’t need to migrate them all at once. But you can to be consistent on a class level, you cannot mix SCR and OSGI annotations in a single class. This is achieved by an extension to the maven-bundle-plugin.

In short, answering your question is YES!

Hope that helps!

Regards,

Santosh

Avatar

Level 7

Yes, you can do that but cannot mix at a class level.

 

You can mix SCR annotations and OSGI annotations in a project, you don’t need to migrate them all at once. But you can to be consistent on a class level, you cannot mix SCR and OSGI annotations in a single class. This is achieved by an extension to the maven-bundle-plugin.

 

Refer for more details: https://cqdump.joerghoh.de/2019/01/03/from-scr-annotations-to-osgi-annotations/ 

 

Getting older codebases upgraded, however can be a bit more of a challenge. You could leave legacy projects using the Apache Felix SCR annotations, however these are now officially deprecated by the Apache Felix project and will not be receiving any further updates so you may miss out on new features and capabilities available in the OSGi annotations.