Tagged articles
2 articles
Page 1 of 1
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Jun 3, 2024 · Backend Development

Why Static Field Injection Fails in Spring 6 and How to Do It Correctly

This article examines why Spring 6 does not support injecting static fields or methods with @Resource, @Autowired, or @Inject, demonstrates the resulting errors, and presents proper ways to inject static dependencies using instance‑method or constructor injection, backed by source‑code analysis of the relevant bean post‑processors.

Backend DevelopmentStatic Fieldsdependency-injection
0 likes · 9 min read
Why Static Field Injection Fails in Spring 6 and How to Do It Correctly
Senior Brother's Insights
Senior Brother's Insights
Oct 27, 2019 · Fundamentals

Why Accessing a Superclass Static Field Skips Subclass Initialization – JVM Class Loading Explained

This article examines common Java interview questions about static field access, demonstrates how the JVM loads and initializes classes, explains why a subclass may not be initialized when referencing a superclass static variable, and details each phase of the JVM class‑loading lifecycle.

Bytecode VerificationInitializationJVM
0 likes · 13 min read
Why Accessing a Superclass Static Field Skips Subclass Initialization – JVM Class Loading Explained