Spring Boot Env Var Issue: IntelliJ Cache Gotcha

Spent 20 minutes wondering why my Spring Boot app was not reading environment variables The code looked fine @Value("${DATABASE_URL}") private String dbUrl; application properties had nothing wrong But dbUrl was always null The problem was I set the environment variable after starting the IDE IntelliJ caches environment variables at startup so it never picked up the new one The fix was just restarting IntelliJ One restart and everything worked Spring Boot reads environment variables correctly but your IDE might not refresh them automatically What simple issue has wasted your time lately #Java #SpringBoot #Debugging #BackendDevelopment #IntelliJ

This also happens with Docker containers if you update env variables without rebuilding the container

Like
Reply

To view or add a comment, sign in

Explore content categories