The @Param **looks** like @Inject but the timing is very different.
@Inject happens during the constructor's call. Right after that HK2
calls postConstruct().
@Param is injected long after that.
@Param's are guaranteed to be set when your execute method is called --
but not before.
On 7/6/2010 7:26 AM, Kumar Jayanti wrote:
> Jerome Dochez wrote:
>> I think your postConstruct implementation is throwing an exception,
>> and the command framework is tagging the implementation as invalid.
>> have you checked the log ?
> ok, i was trying to access an injected command parameter @Param and
> call toCharArray() on it inside postConstruct(). I did not expect the
> param to be null. I will double check.
>
> regards,
> kumar
>>
>> On 7/5/10 3:19 AM, Kumar Jayanti wrote:
>>> Hi,
>>>
>>> I am trying to make a Class that implements AdminCommand to also
>>> implement org.jvnet.hk2.component.PostConstruct. If i do this then
>>> the AdminCommand is no longer recognized as an admin command. Is
>>> this a Feature or a Bug or is this expected.
>>>
>>> For example i changed the class CreateFileUser.java
>>>
>>> public class CreateFileUser implements AdminCommand, PostConstruct {
>>> ...
>>> }
>>>
>>> After doing this when i try create-file-user i get the following
>>> error :
>>>
>>> >.\asadmin create-file-user test
>>>
>>> Closest matching local and remote command(s):
>>> create-file-user
>>> Command create-file-user failed.
>>>
>>>
>>> regards,
>>> kumar
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
--
Byron Nevins - Oracle Corporation
Home: 650-359-1290
Cell: 650-784-4123
Sierra: 209-295-2188