1

There's a convenient method in Google Guice which allows binding of properties in one call:

Names.bindProperties(binder(), myProperties);

which are then injectable by annotation:

@Inject
@Named("my.properties.server.url")
private String serverUrl;

Is there an equivalent method in CDI (implemented by Weld) or something even better?

Boris Pavlović
  • 63,078
  • 28
  • 122
  • 148

1 Answers1

2

Not in core CDI, but DeltaSpike's ConfigProperty (https://cwiki.apache.org/DeltaSpike/temporary-documentation.html#TemporaryDocumentation-@ConfigProperty) will probably do what you want.

LightGuard
  • 5,298
  • 19
  • 19