Spring Core

Related Tags

Tutorials

Spring Framework 7: What’s New, Features and Examples

Spring Framework 7 keeps Java 17 but moves to Jakarta EE 11, JSpecify null-safety and Jackson 3. This overview lists every notable change in a summary table and shows the main new features, such as @Retryable, API versioning and BeanRegistrar, with short examples.

Spring @Lookup Method Injection

Spring lookup method injection is the container’s ability to override methods on container-managed beans and return another container-managed bean.

Spring: Injecting Prototype Bean into Singleton Bean

Spring context supports singleton and prototype bean scopes along with four other scopes specific to the web context. The singleton is the default bean scope. A common problem arises when we want to inject a prototype-scoped bean into a singleton-scoped bean. In this case, as the singleton bean is initialized …

Spring Annotations List

Learn about the most widely used spring annotations. In this tutorial, we will briefly cover the important annotations which are provided by spring core to define beans and create complex application context configurations. 1. Annotations in Spring Framework Similar to other places, annotations help by providing metadata and instructions to …

Spring ResourceBundleMessageSource Example with Spring Boot

Show text in the user’s language with Spring’s ResourceBundleMessageSource and one messages.properties file per language. Learn getMessage() with arguments, the order in which Spring checks the files, UTF-8, missing keys and the Spring Boot setup.

Spring BeanPostProcessor Example

Spring BeanPostProcessor allows for custom modification of new bean instances created by spring bean factory. Spring AOP classes use bean post-processors

Spring: Reading an Internal or External Resource

Learn different ways to load resources or files (e.g. text files, XML files, properties files, or image files) into the Spring application context. Spring ResourceLoader provides a unified getResource() method to retrieve an external resource by the resource path. 1. Spring Resource Interface The Spring Resource is a general interface …

Spring static factory-method example

In Spring framework, if you want to create a bean by invoking a static factory-method, whose purpose is to encapsulate the object-creation process in a static method then you could use factory-method attribute. Read More : Spring FactoryBean Static factory method example If you want to create different EmployeeDTO objects …

Spring FactoryBean with Example

In Spring, FactoryBean creates beans that cannot be created using the ‘new’ keyword and involve complex initialization or configuration.

Spring Autowiring: @Autowired, @Qualifier and @Primary

Spring autowiring finds a matching bean by type and injects it. Learn how Spring picks between several beans with @Qualifier, @Primary and @Fallback, how to declare optional dependencies, and what breaks with circular dependencies.

Spring Bean Autowire by Constructor

Spring bean autowiring “byConstructor” is the recommended approach and injects dependencies into a bean by utilizing its constructor.

Spring Bean Autowire ‘byName’ Example

In Spring Framework, autowiring by name is a feature that allows developers to inject dependencies into a bean by matching the property name with the name of the target bean. This is achieved using the @Autowired annotation (Java Configuration) along with the byName attribute (XML Configuration). 1. What is Autowiring …

Spring Bean Life Cycle in Spring Boot: Phases and Order

The Spring bean life cycle runs from instantiation and dependency injection to the init callbacks and, at shutdown, the destroy callbacks. See the exact callback order in a Spring Boot app with real output, plus the Aware interfaces, XML config and the shutdown hook.

Spring Bean Scopes

The beans in Spring or Spring Boot can be created in six different scopes: singleton, prototype, request, session, application and websocket.

Spring 3: Timer Tasks

Timer is a utility class which is used to schedule tasks for both one time and repeated execution in spring applications. Timer is dependent on system clock

IoC vs DI in Spring: Key Differences With Examples

In Spring, our classes do not create their objects with new. Spring creates the objects and hands them over. IoC is the name of this idea, and DI is how Spring hands the objects over. Includes BeanFactory vs ApplicationContext, constructor, setter and field injection, @Primary and @Qualifier, and a tested example in plain Spring and Spring Boot.

Spring @ExceptionHandler vs @ControllerAdvice with Examples

Spring @ExceptionHandler methods handle exceptions in one controller, and the same methods in a @ControllerAdvice class handle them for every controller. Learn the difference, return ProblemDetail (RFC 9457) bodies, handle validation errors and @ResponseStatus, and test each handler with MockMvc on Spring Boot 4.

Spring MVC Interceptor Example – XML and Annotation Java Config

In this Spring tutorial, we will learn to use spring mvc interceptor in spring mvc applications. This tutorial is very short to focus only on spring interceptor configuration and usage. Interceptors, as we know, are special web programming constructs which gets invoked every time when a certain pre-configured web request …

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.