Difference between annotation-config and component-scan » grokonez

Difference between annotation-config and component-scan » grokonez

annotation-config and component-scan are important basic concepts of Spring Core. This tutorial - how to use them and difference between them.

https://grokonez.com/spring-framework/difference-between-annotation-config-and-component-scan

Difference between annotation-config and component-scan

annotation-config and component-scan are important basic concepts of Spring Core. This tutorial helps you understand how to use them and difference between them.

I. Overview

<context:annotation-config> activates all annotations in beans which are already registered in the application context. Those beans could be defined with XML or by package scanning.

<context:component-scan> not only does everything that annotation-config does, but also registers the java classes as a bean which are annotated with @Component, @Service ,@Repository...

II. Usage

Now begin with hierarchy that we want to create in our application: -|Bean Name -|Bean Address -|Bean Customer ------|injected Bean Name ------|injected Bean Address

1. Full Beans in XML

The java class for Bean are:

public class Name{ //... }
public class Address{ //... }

public class Customer { private Name name; private Address address;

public Customer() //...
public void setName(Name name) //setter injection...
public void setAddress(Address address) //setter injection...

}

More at:

https://grokonez.com/spring-framework/difference-between-annotation-config-and-component-scan

Difference between annotation-config and component-scan

spring

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Spring vs Spring BooDifference Between Spring and Spring Boot

In this tutorial, we'll learn how does using Spring Boot make application development easier? Read ahead to find out.

Spring Full Course - Learn Spring Framework in 4 Hours | Spring Framework Tutorial

This Edureka Spring Full Course video will help you learn Spring Framework from scratch with examples. This Spring Tutorial is ideal for both beginners as well as professionals who want to master the Spring Framework.

Spring Data JPA - Spring Boot Tutorial for Beginners

In this video we will talk about JPA and Spring Data JPA. this course on Spring Boot Tutorials for Beginners. Spring Boot is a tool for getting started very quickly with Spring applications.

Spring Boot Pagination & Filter example | Spring JPA, Pageable

Java Spring Boot Pagination and Filter with Spring Data JPA, Spring Pageable example - Spring JPA Server side Pagination with Filter example

Spring Framework: To Use Or Not To Use, That Is The Question

Spring Framework: To Use Or Not To Use, That Is The Question. The answer lies in this article. Read on and find out.