users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Configuration and Configurable

From: Jan Algermissen <jan.algermissen_at_nordsc.com>
Date: Sat, 3 Nov 2012 15:51:36 +0100

Hi,

actually, I am completely confused by the register() variants.

What is the purpose of providing the ability to pass classes and instances to a Configurable or Configuration?

I the expectation that a passed class will be instantiated and then registered by the Configurable implementation? Or will it be injected? Or what?

Given that all the providers are stateless and usually application scoped, I do not understand why it is not sufficient to have just a single instance and register that.

I see that I could have a

register( new FooFilter("special value A") ) and soome other register( new FooFilter("special value B") ) but given how the rest of the API works, I'd rather see people doing

register( FooFilterA.class) and register( FooFilterB.class)

Yes, it might save you some conditional blocks in feature implementations

e.g. register( new FooFilter( annotationXy.getValue() )) instead of if(annotationXy.getValue() == ...) { register(...) }


, but I wonder who will be able to keep track of the provider instances that end up in ones runtime?


Or, (again) am I missing something?

Jan