Because when the class loader loads the static values, the Spring context is not yet necessarily loaded.
So the class loader won’t properly inject the static fields in the bean and will fail.
More Related Contents:
- Spring @Autowire on Properties vs Constructor
- Is there a way to @Autowire a bean that requires constructor arguments?
- How do I mock an autowired @Value field in Spring with Mockito?
- Spring DI – Autowired property is null in a REST service
- Spring injects dependencies in constructor without @Autowired annotation
- Where is the @Autowired annotation supposed to go – on the property or the method?
- Spring can you autowire inside an abstract class?
- spring autowiring with unique beans: Spring expected single matching bean but found 2
- @Autowired in static classes
- How does Spring annotation @Autowired work?
- Inject and Resource and Autowired annotations
- Injection of autowired dependencies failed;
- Exclude subpackages from Spring autowiring?
- Autowiring in servlet
- What is the difference between ApplicationContext and WebApplicationContext in Spring MVC?
- How does spring.jpa.hibernate.ddl-auto property exactly work in Spring?
- @Service are constructed twice
- How do I get the Session Object in Spring?
- Spring XML file configuration hierarchy help/explanation
- Environment Specific application.properties file in Spring Boot application [closed]
- Spring Security 3.2 CSRF support for multipart requests
- spring boot war without tomcat embedded
- Added Springfox Swagger-UI and it’s not working, what am I missing?
- How to call a method after bean initialization is complete?
- What is Dependency Injection and Inversion of Control in Spring Framework?
- What is the difference between @Configuration and @Component in Spring?
- Changing default welcome-page for spring-boot application deployed as a war
- How to prevent Spring Boot daemon/server application from closing/shutting down immediately?
- Understanding contexts in Spring MVC
- With Spring Data REST, why is the @Version property becoming an ETag and not included in the representation?