Performance: Environment variables in configuration
MEDIUM IMPACT
This affects the application startup time and configuration loading speed, impacting how fast the app becomes ready to serve requests.
public class AppConfig { @Value("${CONFIG_VALUE}") private String configValue; // Environment variable injected once at startup // No runtime file parsing needed }
public class AppConfig { @Value("${config.value}") private String configValue; // Using a heavy config file parsing at runtime public void loadConfig() { // Reads large config file on every request Properties props = new Properties(); try (InputStream input = new FileInputStream("config.properties")) { props.load(input); configValue = props.getProperty("config.value"); } catch (IOException e) { e.printStackTrace(); } } }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Reading config files on every request | N/A | N/A | N/A | [X] Bad |
| Using environment variables injected at startup | N/A | N/A | N/A | [OK] Good |