@PostInject

The @PostInject annotation is used for methods that should be executed after the object is fully constructed and all its dependencies are injected. This is particularly useful for initialization logic that depends on injected dependencies.

import dev.fumaz.infuse.annotation.PostInject;

public class NetworkService {
    @Inject
    private HttpClient httpClient;

    @PostInject
    public void initialize() {
        httpClient.setupConnection();
    }
}

Last updated