Hi Steinar,

you have an example here:

https://github.com/apache/karaf/blob/main/bundle/core/src/main/java/org/apache/karaf/bundle/command/BundleCommand.java#L45

Basically, just add @Reference on BundleContext field and you will
have it injected.

Regards
JB

On Thu, Oct 27, 2022 at 9:01 PM Steinar Bang <[email protected]> wrote:
>
> >>>>> Steinar Bang <[email protected]>:
>
> >>>>> Jean-Baptiste Onofré <[email protected]>:
> >> Hi
> >> You can @inject BundleContext, I can find couple of examples ?
>
> > Yes, please! Thanks!
>
> > I tried googling for examples, but everything I found was for older 
> > versions of karaf.
>
> (and google found me no examples that injected BundleContext or docs saying 
> that you could inject BundleContext)
>
>

Reply via email to