Describe bean lifecycle callbacks.
Spring creates a bean, injects dependencies, applies post-processors, invokes initialization callbacks, and eventually runs destruction callbacks for managed beans when the context closes
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 1993–2004 of 3610 questions
Spring creates a bean, injects dependencies, applies post-processors, invokes initialization callbacks, and eventually runs destruction callbacks for managed beans when the context closes
Spring AOP separates cross-cutting behavior such as transactions and method interception from business logic
A servlet Filter runs at the servlet layer before MVC dispatch; a HandlerInterceptor participates in Spring MVC handler execution and can access handler metadata
CORS is a browser-enforced policy in which the server states which cross-origin requests are allowed
Spring Security uses a filter chain to authenticate requests and authorize access to routes or methods
A resource server validates bearer tokens and maps validated claims to an authenticated principal and authorities
Method security applies authorization policies to service or method calls, complementing URL-based rules
Unit tests construct a service with controlled collaborators and test observable behavior without loading the full application context
@SpringBootTest loads the application context for integration-style tests of configuration and bean wiring
@WebMvcTest loads a focused MVC slice for controller routing, serialization, validation, and status codes
@DataJpaTest focuses on entity and repository behavior and commonly rolls back test transactions
Testcontainers runs disposable services such as PostgreSQL or Kafka for tests, providing more realistic integration behavior than many in-memory substitutes