Local Vs Bundle Java use-class | Community
Skip to main content
VeenaVikraman
Community Advisor
Community Advisor
May 25, 2021
Solved

Local Vs Bundle Java use-class

  • May 25, 2021
  • 1 reply
  • 1884 views

Hi All

 

  Greetings. Hope all of you are staying safe and healthy and keeping your people safe. I was going through the documentation for use api. https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/use-api-java.html?lang=en I saw this interesting note recommended by Adobe, which said 

 

NOTE

local Java use-class is recommended when the use-class is specific to the component in question.

bundle Java use-class is recommended when the Java code implements a service that is accessed from multiple HTL components.

 

I was wondering what is exactly the best practice. I personally use only bundle Java use-class (Mostly Sling Models) for all the backend processing , even when it is single component specific. For quick fixes, I sometimes use Javascript Use-API rather than a local Java use-class.  What are your best practices in this regard ? I am trying to understand what I am doing wrong in this case ? 

 

Thanks and Stay Safe

Veena ✌

 

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 joerghoh

Best practice is to keep all Java code in bundles. Then the compilation is done during build-time and not during runtime.

1 reply

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
May 25, 2021

Best practice is to keep all Java code in bundles. Then the compilation is done during build-time and not during runtime.

VeenaVikraman
Community Advisor
Community Advisor
May 26, 2021
Thanks Jorg. Since it was in the documentation, I was wondering if I was doing wrong all this time. This helps.