Registering resources in ResourceConfig leads to warnings
Hi,
we register Resources using the ResourceConfig.register(Object object) method. This works and has worked until now. However now (2.26) we are getting a warning:
Oct 17, 2017 1:47:00 PM org.glassfish.jersey.internal.inject.Providers checkProviderRuntime WARNING: A provider war.HelloWorldResource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider war.HelloWorldResource will be ignored.
It looks like the check assumes that no resources are registered in this way. Is this a bug or are we misusing the ResourceConfig API?
I've attached a minimal reproducing case based on the jersey-example-java8-webapp archetype. Running war.App leads to the warning above.
Thanks & best regards, Silvestre
Same issue after updating from jersey 2.25.1 to 2.26.
@jansupol does your "question" label imply that this is not a bug but the expected behaviour? Could you explain?
Jersey started to provide more warnings lately, so it is possible that users can see more warnings than in the previous versions. The question in the issue description suggested you did not feel strongly about the issue, but if you now feel this is positively a bug, I am happy to change the label for you.
I agree with Silvestre. I find it a huge plus of Jersey that it allows for manual dependency injection. I also would like the warning to go away if possible please.
Has anyone found a workaround for this?
Question: from the text it is not clear to me whether this is just a warning - or whether things actually break. Which is it?
@jvissers it is just a warning. For me its a reason to stay with the older version as I don't want to clutter the output with this pointless warnings. @electrum, you could try to hack into the logger or use Java.lang.System.setErr() to specifically suppress these warnings.
If you want to stop it showing the messages you can set in your logger settings org.glassfish.jersey.internal.inject.Providers=SEVERE to stop it appearing