Performance: @Value for property injection
LOW IMPACT
This affects application startup time and memory usage by injecting configuration values into Spring beans.
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @Component @ConfigurationProperties(prefix = "my") public class MyProperties { private String property; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } }
public class MyService { @Value("${my.property}") private String myProperty; public String getProperty() { return myProperty; } }
| Pattern | Reflection Calls | Startup Time Impact | Runtime Cost | Verdict |
|---|---|---|---|---|
| Multiple @Value annotations | High (one per field) | Medium (more reflection calls) | Negligible | [!] OK |
| @ConfigurationProperties binding | Low (batched binding) | Low (faster startup) | Negligible | [OK] Good |