hostinger 2.5.0 Help

Autowired

The Spring annotation @Autowired can be used to access service or component classes.

For technical reasons, the @Autowired annotation can currently only be used for internal module service classes.

There is currently a static workaround for services from the core.

@Autowired private ProxMoxPool proxMoxPool;
private ModuleService moduleService = AutowireLoader.getBean(ModuleService.class);

For example, if you create the module "ProxMox" with the component ProxMoxPool, you can use Autowire within your module to access ProxMoxPool.

However, if you want to access beans such as ModuleService from the core of Hostinger, you need to use the AutowireLoader.

Last modified: 16 February 2025