`@PostConstruct` runs after the bean is created and dependencies are injected. `@PreDestroy` runs when the application context is shutting down (for beans it manages, typically singletons). A common gotcha: Spring doesn’t automatically call destroy callbacks for prototype-scoped beans.
Expanding on the short answer — what usually matters in practice:
A tiny example (an explanation template):
// Example: discuss trade-offs for "bean-lifecycle:-when-do-`@postconstruct`-and-`@p"
function explain() {
// Start from the core idea:
// `@PostConstruct` runs after the bean is created and dependencies are injected. `@PreDestro
}