title: Pass Spring @Value into static @BeforeAll Junit5 method
body: <p>I have such case, I need to set system properties, before I inject testable class, because this class should be init with this system property for test. </p>
  
  <p>To do this I run setting of system vars in <code>@BeforeAll</code> method which is <code>static</code> :</p>
  
  <pre><code>    @Autowired
      private MyService myService;  
  
      @BeforeAll
      public static void init(){
          System.setProperty("AZURE_CLIENT_ID", "someId");
          System.setProperty("AZURE_TENANT_ID", "someId");
          System.setProperty("AZURE_CLIENT_SECRET", "someSecret" );
      }
  </code></pre>
  
  <p>And it works perfectly fine.</p>
  
  <p>But now I want to read this property from application.yaml, like :</p>
  
  <pre><code>    @Value("clientId")
      private String clientId;
  
      @BeforeAll
      public static void init(){
          System.setProperty("AZURE_CLIENT_ID", clientId);
          System.setProperty("AZURE_TENANT_ID", tenantId);
          System.setProperty("AZURE_CLIENT_SECRET", someSecret);
      }
  </code></pre>
  
  <p>Problem is that I cannot reference non-static from static method and I definitely need to run <code>@BeforeAll</code> first to set System properties. </p>
  
  <p>Any solution for this?</p>