jeudi 5 juillet 2018

filter for service with guice injector

we have several modules each with few services. we are using play framework and it works well with juice dependency injector.

for example,

For module x,

@implementedBy(XI1Impl.class) interface XI1 {....}

class XI1Impl implements XI1 {....}

Now, we need to add a common check API before invoking any service API. The simplest way is to add check call inside method implementation for each API for each service for each module.

Is there any better way to add a common check for services so consumer application when injecting any of service and call any service API first the check call should execute.

Does Guice has any annotation or any way to configure check API call such that while injecting service it will first execute specific call

In play framework, filter class can do the same job for the controller, but I do not have any idea if similar concept present at the service level.

Please suggest me if you have any idea.

Aucun commentaire:

Enregistrer un commentaire