Knotx / knotx

Knot.x is a highly-efficient and scalable integration framework designed to build backend APIs
https://knotx.io
Apache License 2.0
126 stars 26 forks source link

Automatical updating of `META-INF/services` with annotations #506

Open Voycawojka opened 4 years ago

Voycawojka commented 4 years ago

Is your feature request related to a problem? Please describe. It's very easy to forget about updating META-INF/services for ServiceLoader every time HandlerFactory or ActionFactory is created/deleted.

Describe the solution you'd like An annotation could be used to automaticaly detect factories. One existing solution is Google's AutoService. Using it with Knot.x would look like this:

@AutoService(HandlerFactory.class)
class MyHandlerFactory implements HandlerFactory {
  // …
}

No need to manually update the META-INF. Same for action factories.

Describe alternatives you've considered Custom Knot.x annotations could be developed, but it would require a lot more work to do.

Mateusz512 commented 4 years ago

Also please consider creating an annotation for getName method

@AutoService(Action.class)
@Name("my-custom-action")
class MyAction implements Action {
  // …
}