Skip to content

Instantly share code, notes, and snippets.

@joemaffia
Last active December 25, 2015 16:19
Show Gist options
  • Save joemaffia/7004497 to your computer and use it in GitHub Desktop.
Save joemaffia/7004497 to your computer and use it in GitHub Desktop.
Adobe CQ OSGi service using SCR annotations.
package com.company.cq.services;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.Constants;
/**
* Example OSGi service using SCR annotations.
*/
@Component(immediate = true, metatype = true)
@Service(GoodbyeWorldService.class)
@Properties({
@Property(name = Constants.SERVICE_VENDOR, value = "CQ Blueprints"),
@Property(name = Constants.SERVICE_DESCRIPTION, value = "Provides a friendly farewell.")
})
public class GoodbyeWorldService {
public String getMessage(String name) {
return String.format("Goodbye %s!", name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment