-
1. Re: Inject a Map - Spring DI alternative
kwintesencja Nov 23, 2012 4:24 AM (in response to gavind)Hi there,
im not a Spring guy so i didnt got the ideia behind that bean configuration, could you explain what kind of use case you want to achive with that?
-
2. Re: Inject a Map - Spring DI alternative
luksa Nov 23, 2012 9:50 AM (in response to gavind)If I understand, you would like to have a configurable injectable Map, which would map CreditCardTypeEnum to some handler bean.
The proper way to do this in CDI is to create a producer method, but you would need to implement your own way of reading a configuration file, if you really need the mapping to be configurable through a conf file. Check if DeltaSpike has any extensions that would allow you to do this through xml only.
-
3. Re: Inject a Map - Spring DI alternative
gavind Nov 23, 2012 11:10 AM (in response to luksa)@Rafael - Marko got it, I needed to have a configurable injectible Map, which doesn't seem trivial in weld. I'll read up on the 'producer method' again.
Also, I'd prefer not to use a config file, is that possible?
-
4. Re: Inject a Map - Spring DI alternative
kwintesencja Nov 23, 2012 4:13 PM (in response to gavind)1 of 1 people found this helpfulI almost got the idea
can i call this a configurable injectable map? https://github.com/rmpestano/serverfaces/blob/master/serverfaces-common/src/main/java/org/serverfaces/common/OIDProvider.java
and here where i use it: https://github.com/rmpestano/serverfaces/blob/master/serverfaces-agent/src/test/java/org/serverfaces/agent/test/TestAgent.java
maybe it can help.
-
5. Re: Inject a Map - Spring DI alternative
gavind Nov 23, 2012 4:48 PM (in response to kwintesencja)Thank you Rafael! That looks amazing.