Tagged “Spring”
13 articles with this tag.
- AOP & proxiesHow Spring AOP adds cross-cutting behaviour: aspects, join points, pointcuts and advice; the five advice types with examples; pointcut expressions; JDK vs CGLIB proxies; ordering aspects; the self-invocation trap; which Spring features are built on AOP; and when to use AspectJ weaving instead.
- Bean lifecycle & scopesWhat happens to a Spring bean from definition to destruction: instantiation, injection, Aware callbacks, BeanPostProcessors, @PostConstruct and InitializingBean, SmartLifecycle, @PreDestroy and graceful shutdown; plus singleton, prototype, request, session and application scopes, scoped proxies, and thread-safety rules.
- TransactionsHow Spring manages transactions: ACID, PlatformTransactionManager, how @Transactional works through proxies, rollback rules, all seven propagation behaviours with use cases, isolation levels and anomalies, read-only transactions, timeouts, optimistic and pessimistic locking, programmatic TransactionTemplate, and transactions with messaging.
- Dependency InjectionWhat dependency injection is, why constructor injection is the default, how a composition root works in plain Java, and what the Spring container automates — with a runnable before-and-after example and interview questions.
- ApplicationContext & BeanFactoryHow the Spring IoC container works: BeanFactory vs ApplicationContext, bean definitions, the refresh() startup sequence, BeanFactoryPostProcessor and BeanPostProcessor extension points, dependency resolution (by type, @Qualifier, @Primary, collections, ObjectProvider), circular dependencies, context hierarchies, and AOT processing.
- ProxyControl access to an object through a stand-in with the same interface. Virtual, protection, caching and remote proxies in a runnable Java 21 example, JDK dynamic proxies, how Spring's @Transactional and lazy JPA associations rely on proxies, and Proxy versus Decorator.
- REST design & error handlingDesigning REST APIs with Spring: resources and URIs, HTTP methods, idempotency and status codes, validation, DTOs, pagination, versioning (Spring Framework 7 API versioning), idempotency keys, HATEOAS and OpenAPI docs, plus global error handling with @RestControllerAdvice and RFC 9457 Problem Details, and HTTP interface clients.
- Application eventsDecoupling with Spring's event mechanism: publishing events, @EventListener, ordering and conditions, synchronous vs @Async listeners, @TransactionalEventListener phases, built-in lifecycle events, error handling, Spring Modulith's event publication registry, and when to use a message broker instead.
- Caching & RedisCaching in Spring applications: cache-aside and other patterns, @Cacheable, @CachePut, @CacheEvict and @Caching, keys and conditions, cache providers (Caffeine locally, Redis distributed), Redis configuration with TTLs and serialisation, multi-level caching, invalidation and consistency, cache stampede protection, Hibernate second-level cache, and monitoring.
- Configuration & scanningDefining beans in Spring: stereotype annotations and component scanning, @Configuration and @Bean methods, full vs lite mode and proxyBeanMethods, @Import, profiles and @Profile, programmatic registration with BeanRegistrar (Spring 7), and how to organise configuration in large applications.
- SpELWhat SpEL is and where Spring uses it: syntax (literals, properties, methods, operators, collection selection and projection, safe navigation, Elvis), bean references, @Value with ${} vs #{}, SpEL in security, caching and scheduling annotations, evaluating expressions programmatically, compilation, and security risks of user-supplied expressions.
- Spring MVC architectureHow a request flows through Spring MVC: the front-controller DispatcherServlet, HandlerMapping and HandlerAdapter, argument resolvers and validation, HttpMessageConverters (Jackson 3), return value handling, interceptors vs servlet filters, exception resolvers, the threading model with virtual threads, and the components you can customise.
- WebFlux & ReactorReactive programming in Spring: the Reactive Streams contract and backpressure, Mono and Flux, assembly vs subscription, essential operators (map, flatMap, concatMap, zip, retryWhen, timeout), schedulers and never blocking, error handling, WebFlux annotated and functional endpoints on Netty, WebClient, R2DBC, testing with StepVerifier, and when to choose WebFlux vs MVC with virtual threads.