0

I would like to know if it's possible to instantiate a bean in Spring using Java based configuration (providing all the Jax-RS annotations, @Path and so on.. ) , and then tell Jersey to use that bean as resource, avoiding Jersey to instantiate a new class.

Edit: if possible I would like to avoid annotating my bean with @Component or @Service like in the answers you linked here (thanks for prompt reaction!)

Thanks in advance Giulio

Giulio Pulina
  • 344
  • 4
  • 15

1 Answers1

0

Reading this answer (https://stackoverflow.com/a/20578498/554117) was very helpful:

I found out that @Component annotation on the bean/resource (created via Java Config) is needed to make Jersey correctly use the Spring instantiated bean, avoiding it to create a new instance.

Thanks for the support :)

Community
  • 1
  • 1
Giulio Pulina
  • 344
  • 4
  • 15