🚀 Exploring #XMLConfiguration in #SpringFramework As part of my learning journey in the Spring Framework, today I explored how Spring Beans can be configured using XML. 📄 In XML configuration, we define beans inside a configuration file and the Spring Container creates and manages those objects automatically. 🧩 A typical bean definition looks like this: <bean id="orv" class="com.coders.Product"></bean> Here: id → unique name of the bean class → Fully Qualified Name (FQN) of the Java class 📦 I also learned how to load the configuration file using ApplicationContext: ApplicationContext context = new ClassPathXmlApplicationContext("config.xml"); 🔎 Additionally, I explored different ways of injecting values into beans: • Constructor Injection using <constructor-arg> • Setter Injection using <property> (p-namespace) Understanding these concepts helps in managing object creation and dependencies efficiently in Spring applications. Looking forward to learning more advanced concepts and building real-world backend applications with Spring and Spring Boot! 💻 #SpringFramework #Java #BackendDevelopment #SpringBoot #LearningJourney #SoftwareDevelopment
Spring XML Configuration with Spring Framework
More Relevant Posts
-
Hi everyone 👋 Continuing the Spring Boot Annotation Series 👇 📌 Spring Boot Annotation Series Part 25 – @ModelAttribute @ModelAttribute is used to bind request data (form data / query params) to a Java object. It is part of the Spring Framework and mainly used in Spring MVC applications. 🔹 Why do we use @ModelAttribute? When we receive multiple values from a request (like form data), instead of handling each parameter separately, we can bind them directly to an object. 👉 Makes code clean and structured. 🔹 Where is it used? Form submissions (HTML forms) Query parameters MVC applications (not mostly REST APIs) 🔹 In Simple Words @ModelAttribute takes request data and converts it into a Java object. 👉 🧠 Quick Understanding Binds request data to object Used in form handling Works with query/form data Not mainly used for JSON #SpringBoot #Java #ModelAttribute #SpringMVC #BackendDevelopment #LearningInPublic
To view or add a comment, sign in
-
# Best Feature # Java 17 Feature Highlight: Record Class (with Example) While working on backend development, I explored Record classes in Java 17 — a powerful way to reduce boilerplate code. 🔹 Why use Records? ✔ Less code (no getters, constructors, toString needed) ✔ Immutable by default ✔ Ideal for DTOs & API responses 🔹 Traditional Way: class User { private String name; private int age; public User(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public int getAge() { return age; } } -------------------------------------------------------------------------- 🔹 Using Record (Java 17): record User(String name, int age) {} 1. Same functionality with minimal code! 2. Records help write cleaner, more maintainable applications by focusing on data rather than boilerplate. Excited to explore more modern Java features #Java #Java17 #BackendDevelopment #CleanCode #SpringBoot #DeveloperJourney #SoftwareEngineering
To view or add a comment, sign in
-
Hi everyone 👋 After a short break, excited to get back and continue the learning journey! Let’s continue the Spring Boot Annotation Series 👇 📌 Spring Boot Annotation Series part 23 – @RequestBody @RequestBody is used to read data from the HTTP request body and convert it into a Java object. It is part of the Spring Framework and widely used in REST APIs built with Spring Boot. 🔹 Why do we use @RequestBody? When we send data in POST/PUT requests (usually in JSON format), we need a way to convert that data into a Java object. 👉 @RequestBody does that automatically. 🔹 How does it work? - Spring uses Jackson library internally - Converts JSON → Java Object - And Java Object → JSON (in response) 🔹 In Simple Words @RequestBody takes JSON data from request and converts it into a Java object. 👉 🧠 Quick Understanding - Used with POST/PUT requests - Converts JSON to Java object - Uses Jackson internally - Very common in REST APIs #SpringBoot #Java #RESTAPI #RequestBody #BackendDevelopment #LearningInPublic
To view or add a comment, sign in
-
Understanding Annotations in Spring Boot: Annotations play a key role in how Spring Boot applications are built and configured. But what exactly are they? Annotations are metadata added to Java code that tell the Spring framework how to behave or configure certain components. Instead of writing large configuration files, Spring Boot uses annotations to simplify development. Some commonly used annotations include: 🔹 @SpringBootApplication Marks the main class and enables auto-configuration, component scanning, and configuration support. 🔹 @RestController / @Controller Used to handle incoming HTTP requests and return responses. 🔹 @Service Indicates that a class contains business logic. 🔹 @Repository Used for database interaction and persistence operations. 🔹 @Autowired Allows Spring to automatically inject dependencies. ✅ These annotations help reduce boilerplate code and make Spring Boot applications easier to build and manage. Understanding how and why annotations are used is an important step toward mastering Spring Boot. #SpringBoot #Java #BackendDevelopment #SoftwareDevelopment
To view or add a comment, sign in
-
🚀 Day 47/90 How Spring Boot loads 130+ AutoConfigurations (and how to debug them) Today’s learning connected two very important concepts: 👉 How Spring Boot loads auto-configurations internally 👉 How we can see which ones are applied or skipped 🔹 How Spring Boot loads AutoConfigurations? Spring Boot doesn’t magically configure everything. It follows a structured process: 1️⃣ Your application starts with @SpringBootApplication 2️⃣ This internally includes @EnableAutoConfiguration 3️⃣ Spring Boot then scans a special file: 📄 META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports This file contains a list of 100+ AutoConfiguration classes like: - DataSourceAutoConfiguration - HibernateJpaAutoConfiguration - WebMvcAutoConfiguration 4️⃣ These classes are loaded into the Spring context But here’s the catch 👇 👉 They are NOT blindly applied Each auto-configuration uses conditions like: @ConditionalOnClass @ConditionalOnBean @ConditionalOnProperty So Spring Boot decides: ✔ Apply if conditions match ❌ Skip if conditions fail 🔹 How to see this decision (VERY IMPORTANT 🔥) We can enable debugging using this property: debug=true 📍 Add it in application.properties 🔹 What happens after enabling this? At application startup, Spring prints a Condition Evaluation Report in logs: You will see: ✅ Positive Matches Configurations that were successfully applied ❌ Negative Matches Configurations that were skipped + reason ⚠️ Conditional Matches Dependent configurations 🔹 Example Insight You might see logs like: ✔ DataSourceAutoConfiguration matched ❌ JpaRepositoriesAutoConfiguration did not match (missing dependency) This tells you EXACTLY why something is working or not. 🔹 Why this is powerful? ▪️Understand which beans Spring created automatically ▪️Debug issues in: JPA / Hibernate Security DataSource 🔹 Pro Tip ⭐ Instead of full debug, you can use targeted logging: logging.level.org.springframework.boot.autoconfigure=DEBUG 🔹 Today's Tiny Win 💡 Today you moved from: 👉 “Spring Boot works magically” to 👉 “I can SEE and DEBUG Spring Boot decisions internally”🍀☘️ #SpringBoot #AutoConfiguration #Java #BackendDeveloper #90DaysChallenge
To view or add a comment, sign in
-
If you’re building APIs with Spring Boot, these annotations will make your life much easier. When I started learning Spring Boot, the number of annotations was confusing. But over time I realized that a few key annotations power most backend systems. Here are some of the most useful ones. ⸻ 🧠 Essential Spring Boot Annotations 1️⃣ @RestController Creates REST APIs. @RestController @RequestMapping("/users") public class UserController { } 2️⃣ @Service Marks the service layer. @Service public class UserService { } 3️⃣ @Repository Handles database interaction. @Repository public interface UserRepository extends JpaRepository<User, Long> { } 4️⃣ @Autowired Injects dependencies automatically. @Autowired private UserService userService; 5️⃣ @RequestBody Maps JSON request data to Java object. @PostMapping public User createUser( @RequestBody User user) { } 💡 Lesson Spring Boot reduces boilerplate code. The real power comes from understanding how these annotations work together. ⸻ Day 13 of becoming production-ready with Spring Boot. Question: Which Spring Boot annotation do you use the most? ⸻ #Java #SpringBoot #BackendEngineering #JavaDeveloper #Programming
To view or add a comment, sign in
-
-
💻 Understanding Spring Beans in Spring Framework As I continue learning Spring, I explored an important concept called Spring Beans. In Spring, a Bean is simply an object that is created, managed, and controlled by the Spring container. In my previous project, I used an Employee class, and Spring created its object using the configuration file. That object is called a Spring Bean. In simple terms: Instead of creating objects manually using new, Spring creates and manages them for us. 🔹 Key points about Spring Beans: ✔ Managed by Spring IoC container ✔ Defined using configuration (XML or annotations) ✔ Supports Dependency Injection ✔ Helps in building loosely coupled applications Understanding Beans helped me clearly see how Spring handles object creation and management internally. Continuing to explore more Spring concepts step by step 🚀 Github Link: -https://lnkd.in/dKrcejQw #Java #SpringFramework #SpringBeans #BackendDevelopment #LearningJourney
To view or add a comment, sign in
-
-
🚀 Day 11: Scope & Memory – Mastering Variable Types in Java 🧠📍 Today’s focus was on understanding where data lives in a program—a crucial step toward writing efficient and predictable code. In Java, the way a variable is declared directly impacts its scope, lifetime, and memory allocation. Here’s how I broke it down: 🔹 1. Local Variables – Temporary Workers ⏱️ • Declared inside methods • Accessible only within that method • Created when the method starts, destroyed when it ends • ⚠️ Must be initialized before use (no default values) 🔹 2. Instance Variables – Object Properties 🏠 • Declared inside a class, outside methods • Require an object to access • Each object gets its own copy • Changes in one object do NOT affect another 🔹 3. Static Variables – Shared Data 🌐 • Declared with the static keyword • Belong to the class, not objects • Accessed using the class name (no object needed) • Only one copy exists, shared across all instances 💡 Key Takeaway: Variable scope is more than just visibility—it’s about memory management and data control. Knowing where and how variables exist helps in building optimized and scalable applications. Step by step, I’m strengthening my foundation in Java and moving closer to writing production-level code. 💻 #JavaFullStack #CoreJava #CodingJourney #VariableScope #MemoryManagement #Day11 #LearningInPublic
To view or add a comment, sign in
-
🚀 Week 17 of My Java Learning Journey! This week, I continued exploring the Spring ecosystem by learning Spring ORM and Spring MVC. It was exciting to see how Spring integrates ORM frameworks with a structured Model–View–Controller architecture to build scalable web applications. 🧠🌐 🧩 Key Learnings: Spring ORM and integration with Hibernate Managing persistence using Spring + Hibernate Spring MVC architecture (Model, View, Controller) Handling HTTP requests using Controller classes View rendering using JSP / Thymeleaf (intro) Understanding the DispatcherServlet workflow 💻 Practice Work: Integrated Hibernate with Spring ORM Built a simple Spring MVC web application Implemented Controller, Service, and DAO layers Performed database CRUD operations through Spring 📝 Outcome: Understood how Spring simplifies web application architecture Learned to build layered backend applications using Spring MVC 🔗 Check out my Week 17 GitHub repo: https://lnkd.in/dT3g_dp9 Excited for Week 18, where I’ll dive into Spring Boot — building modern Java applications with minimal configuration! 🚀 #Java #SpringFramework #SpringMVC #SpringORM #BackendDevelopment #CodingJourney #Git #GitHub #100DaysOfCode #Learning
To view or add a comment, sign in
-
How Ioc Container of Spring Boot Works? Today, I deepened my understanding of how the IoC (Inversion of Control) container works in Spring Boot. The IoC container is the core of Spring’s dependency management system—it takes over the responsibility of creating, managing, and injecting objects (beans) in an application. Instead of manually instantiating objects, the container automatically wires dependencies, which allows developers to write cleaner and more maintainable code. Beans can be defined using annotations like @Component, @Service, @Repository, or via @Configuration and @Bean, and the container ensures their proper initialization and lifecycle management. What fascinated me is how Spring Boot handles everything behind the scenes: it scans packages for components, registers them as bean definitions, resolves dependencies, and manages scopes such as singleton, prototype, or request-scoped beans. It also provides hooks for bean post-processing and lifecycle events like @PostConstruct and @PreDestroy. This system not only reduces boilerplate code but also enables features like testing with mocks, AOP (aspect-oriented programming), and flexible configuration, making the development of complex applications much more manageable. Learning the internal workings of the IoC container gave me a much clearer picture of how Spring Boot promotes decoupled, modular, and maintainable design, which is essential for building scalable Java applications. #SpringBoot #Java #OOP #DependencyInjection
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development