Hello folks,
We are migrating from 6.2 to aem 6.4, So we are replacing scr annotations with OSGI R6 annotations,
While migrating Servlets properties I am not able to find equivalent for "propertyPrivate = true".
Below is the annotation Kindly suggest me the equivalent.
@Component
@Service
@Properties({ @Property(name = "service.description", value = "Servlet used to render alerts"),
@Property(name = "sling.servlet.resourceTypes", value = "sling/servlet/default", propertyPrivate = true),
@Property(name = "sling.servlet.selectors", value = "alertbar", propertyPrivate = true),
@Property(name = "sling.servlet.methods", value = { "GET" }) })
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
You need to declare property inside component annotation.
e.g.
@Component(service = Servlet.class,
property = {
Constants.SERVICE_DESCRIPTION + "=Servlet used to render alerts",
"sling.servlet.methods=" + HttpConstants.METHOD_GET,
"sling.servlet.resourceTypes=sling/servlet/default",
"sling.servlet.selectors=alertbar"
})
Views
Replies
Total Likes
Hi,
You need to declare property inside component annotation.
e.g.
@Component(service = Servlet.class,
property = {
Constants.SERVICE_DESCRIPTION + "=Servlet used to render alerts",
"sling.servlet.methods=" + HttpConstants.METHOD_GET,
"sling.servlet.resourceTypes=sling/servlet/default",
"sling.servlet.selectors=alertbar"
})
Views
Replies
Total Likes
Yeah I am declaring it under @component, But wasn't clear about the "privateProperty", thank you for the reply.
Views
Replies
Total Likes
Hi,
When you declare property under component annotation , it is considered as private property.
And configurable properties are define using ObjectClassDefinition annotation
@Component(
service = Servlet.class,
property =
{ "privateprop=value" }
);
//configurable properties
@Designate(ocd = MyServiceImplConfiguration.class)
public class MyServiceImpl extends MyService {
...
}
// Configuration
@ObjectClassDefinition(name = "My Service Config")
public @interface MyServiceImplConfiguration {
String my_prop1_path() default "/etc/design/MyProj";
...
}
Views
Replies
Total Likes
Thank You for the Reply,
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies