-
Type: Task
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 62
-
Fix Version/s: 73.2
-
Component/s: Technical / Transverse
-
Tags:
It's better not to use xxx-service as a class attribute, because it prevents some hot-reload mechanism from Java. This pattern is used everywhere in the codebase. It's better to call the service inside a method-scope:
Bad:
public class MyClass { private MyService myService; protected MyService getMyService() { if (myService == null) { myService = Framework.getService(MyService.class); } } public void myMethod() { getMyService().doSth( ... ); } }
Good:
public class MyClass { public void myMethod() { MyService myService = Framework.getService(MyService.class); myService.doSth( ... ); } }