Injections

Injections

All services can also injected into objects using the IInjectionService.
In order to support injections, the object must have at least one non-final, non-static field annotated with @Inject.
As of 15.02.2019, injected fields are no longer required to be public

Here's a quick example showing how to retrieve an instance of the InjectionService:

package de.fearnixx.jeak;

import de.fearnixx.jeak.reflect.IInjectionService;
import de.fearnixx.jeak.reflect.Inject;
import de.fearnixx.jeak.reflect.JeakBotPlugin;

@JeakBotPlugin(id = "sometestplugin")
public class TestPlugin {
  
  @Inject
  private IInjectionService injectionService;
}

Special Injections

Configurations require an additional annotation to be injected. See the configuration section for that.


What’s Next