How to inject static class in Spring-Boot?
<p>This question was asked a lot of times. I am bit confused and hope your ideas. </p>

<p>I am integrating Google Cloud Storage in Spring-Boot. </p>

<p>I have config class. </p>

<pre><code>@Component
@ConfigurationProperties(prefix = "gcs.credentials")
public class  GCSConfig {

    private String serviceAccountId;

    //...
}
</code></pre>

<p>Storage factory which implements singleton pattern.</p>

<pre><code>@Component
public class StorageFactory {

    @Autowired
    private static GCSConfig gcsConfig;

    private static Storage instance = null;

    public static synchronized Storage getService() throws GeneralSecurityException, IOException {
        if (instance == null) {
            instance = buildService();
        }
        return instance;
    }

    private static Storage buildService() throws GeneralSecurityException, IOException {

        HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
        JsonFactory jsonFactory = new JacksonFactory();
        // ...
        // I use gcsConfig here
        // ...
        return new Storage.Builder(httpTransport, jsonFactory, credential)
        .setApplicationName("Google Cloud Storage App")
        .build();
    }
}
</code></pre>

<p>And I use StorageFactory in the <code>service</code> like that.</p>

<pre><code>Storage client = StorageFactory.getService()
</code></pre>

<p>I have read that <code>Autowired</code> doesn't inject static members. Is there another  way to implement it? Maybe here Spring-Boot's features which create singleton easily.</p>

<p>What should I read? Could you give me links? Can you guide me in the right direction?</p>

<p>Link for the <a href="https://cloud.google.com/storage/docs/json_api/v1/json-api-java-samples" rel="nofollow">GCS examples</a>.</p>