Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
May 26, 2017 12:58
May 24, 2017 22:19
May 24, 2017 22:19
May 24, 2017 22:19
May 26, 2017 13:00
May 24, 2017 22:19

AEM OSGi Declarative Services Annotations

This project demonstrates the basics of using the OSGi Declarative Services annotations along side the more familiar Felix SCR annotations.

Examples are given for both annotation styles in each of a servlet, service, filter, scheduler and an event handler / listener. These five examples are common AEM project requirements and the examples can be extrapolated out for anything else such as MBeans, Adapters, Workflow Process Steps, Replication Preprocessors, etc...

Note the service example creates the Configuration as a separate class while the other examples create the Configuration as a subclass.

View the associated blog post at

How to build

This project has been built and tested in AEM 6.2.

To build all the modules run in the project root directory the following command with Maven 3:

mvn clean install

Or to deploy the bundle to the author, run

mvn clean install -PautoInstallBundle


Below are a some cURL commands to help you test the components. Navigate to the Felix Configuration console to update component properties.

Servlets and Services

Make a GET request to the servlets which consume the services and respond back with plain text:

curl -u admin:admin http://localhost:4502/bin/felix
curl -u admin:admin http://localhost:4502/bin/osgi

Event Handler

Create a new node under /content and watch the logs:

curl -u admin:admin http://localhost:4502/content/foo -F"myproperty=bar"


View the logs to see the scheduler running every 60 seconds by default.


Make a request to a resouce under /content and watch the logs:

curl -u admin:admin http://localhost:4502/content/geometrixx/en/products/triangle.html

Maven settings

The project comes with the auto-public repository configured. To setup the repository in your Maven settings, refer to: