This example shows the declaration of the class CreateMycontainer that represents an asadmin subcommand that is named create-mycontainer. The subcommand is instantiated for each lookup.
package com.example.mycontainer; import org.glassfish.api.admin.AdminCommand; ... import org.jvnet.hk2.annotations.Service; ... import org.jvnet.hk2.annotations.Scoped; import org.jvnet.hk2.component.PerLookup; /** * Sample subcommand */ @Service(name="create-mycontainer") @Scoped(PerLookup.class) public Class CreateMycontainer implements AdminCommand { … }