🌱 Spring Bean Lifecycle

Press Refresh context and watch Spring bring beans to life in dependency order — instantiate, inject, run BeanPostProcessors, @PostConstruct, ready — then destroy them in reverse on shutdown. See why a prototype bean behaves differently. All in your browser.

★ Star on GitHub
creation order = dependency order (a bean waits for what it needs)
Try this: refresh the context → beans are created bottom-up by dependency (config → datasource → repository → service → controller), each walking instantiate → inject → @PostConstruct → ready. Now close the context → singletons are destroyed in reverse order via @PreDestroy. Then request the prototype → it's built fresh on demand and gets no destroy callback (a classic memory-leak footgun).