Service vs. POJO | Community
Skip to main content
New Participant
February 11, 2016
Solved

Service vs. POJO

  • February 11, 2016
  • 2 replies
  • 964 views

I have to retrieve the value from a component dialog with some business rules. Since the logic is quite complicated, I write a java code. The question is should I make it as a service or just pure POJO? what's the rules and/or criteria to determine it.

 

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jitendra_S_Toma

If your code can be re-used somewhere else. Then, create service otherwise POJO would be fine.

---

Jitendra

2 replies

smacdonald2008
New Participant
February 11, 2016

I agree with Jitendra - if you do not want to have the benefits of a service (ie - dependency injection) - then you can write your Java code as a POJO, wrap it into a JAR and then deploy to AEM within an OSGi bundle without using @Service and @Component. 

Jitendra_S_Toma
Jitendra_S_TomaAccepted solution
New Participant
February 11, 2016

If your code can be re-used somewhere else. Then, create service otherwise POJO would be fine.

---

Jitendra