Expandir la barra de logros de la comunidad.

Mark Solution

Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.

RESUELTAS

'generateComponent = false' property in @SlingServlet annotation

Avatar

Level 9

Hi All,

@SlingServlet(
        paths = { "/content/data" }, generateComponent = false)

In couple of servlets, have seen the above. Went through http://sling.apache.org/documentation/the-sling-engine/servlets.html.

But could not get 

a] What exactly is the purpose of generateComponent = false.

Any thoughts on this will be helpful.

1 solución aceptada

Avatar

Respuesta correcta de
Level 10

@slingServlet includes @Component internally and hence we dont use that annotation specifically which is nothing by generateComponent=true (refer [1]). This enables all the methods or life cycle of component like activate, deactivate etc... 

If you are using @Component also along with your @slingServlet, then we need to use generateComponent=false for @slingServlet else it would have a conflict and throw an exception. refer [2]

 

[1] http://grepcode.com/file/repo1.maven.org/maven2/org.apache.felix/org.apache.felix.scr.annotations/1....

[2] http://versatileankur.blogspot.com/2015/02/maven-scr-plugin-error-in-aem.html

Ver la solución en mensaje original publicado

2 Respuestas

Avatar

Respuesta correcta de
Level 10

@slingServlet includes @Component internally and hence we dont use that annotation specifically which is nothing by generateComponent=true (refer [1]). This enables all the methods or life cycle of component like activate, deactivate etc... 

If you are using @Component also along with your @slingServlet, then we need to use generateComponent=false for @slingServlet else it would have a conflict and throw an exception. refer [2]

 

[1] http://grepcode.com/file/repo1.maven.org/maven2/org.apache.felix/org.apache.felix.scr.annotations/1....

[2] http://versatileankur.blogspot.com/2015/02/maven-scr-plugin-error-in-aem.html

Avatar

Level 9

Hi Lokesh,

Thank you for your reply.