Lecture 32: AOP & Bean Configuration Styles (XML and Annotation)

BMC201 - Web Technology

Mr. Prashant Kumar Nag

2026-03-18

Lecture 32

AOP & Bean Configuration Styles (XML and Annotation)

Week 8 | Unit IV: Spring Framework Basics
BMC201 - Web Technology
Mr. Prashant Kumar Nag, Assistant Professor

Learning Objectives


  • Explain core AOP terms
  • Compare XML and annotation bean configuration
  • Use AOP for cross-cutting concerns

Prerequisites


  • Core Java OOP concepts and interface-based design
  • Basic understanding of Servlets/JSP request flow from Unit III
  • Revision of Lecture 31 before moving into AOP & Bean Configuration Styles (XML and Annotation)

Syllabus Mapping


  • Unit IV topic focus: AOP & Bean Configuration Styles (XML and Annotation)
  • CO alignment: implementation understanding + architecture reasoning
  • Assessment alignment: short definitions + long implementation/design questions

Agenda


  • 5-minute recap from previous lecture
  • Concept deep dive: AOP & Bean Configuration Styles (XML and Annotation)
  • Code/configuration walkthrough and output analysis
  • Debug checklist and exam-oriented summary

Introduction


AOP separates logging/security/transactions from core business logic.

Think About It


Should logging be repeated in every method?

AOP and Config Styles


Aspect, advice, pointcut; XML and annotation configuration approaches

Code Walkthrough


@Configuration
@ComponentScan("com.app")
class AppConfig {}

@Aspect
class LoggingAspect { }

Memory Booster


Syllabus memory points for AOP & Bean Configuration Styles (XML and Annotation):

  • Core recall: Aspect, advice, pointcut, XML/annotation config
  • Exam compare: Cross-cutting with AOP vs duplicated inline concerns
  • Practical anchor: Apply logging aspect and compare XML vs annotation config

Live Demo


Live implementation for AOP & Bean Configuration Styles (XML and Annotation):

?? Open Demo: Lecture 32 - AOP & Bean Configuration Styles (XML and Annotation)

Demo checklist: - implement the key flow for this lecture - verify expected output for one success case - trigger one failure case and explain the fix

Resources & References


Structured Debug Checklist


  1. verify the primary API usage for AOP & Bean Configuration Styles (XML and Annotation) is correct (imports, method names, config)
  2. check request/bean/session flow and object lifecycle assumptions
  3. inspect server logs for the first exception (not just the final symptom)
  4. reproduce one failing case and one passing case before finalizing fixes

Exam Preparation Questions: Short


  • Define AOP & Bean Configuration Styles (XML and Annotation) with one practical use case.
  • Write/identify the key API or construct: Aspect, advice, pointcut, XML/annotation config.
  • Differentiate: Cross-cutting with AOP vs duplicated inline concerns.
  • Mention one common implementation error and correction.

Exam Preparation Questions: Long


  • Explain AOP & Bean Configuration Styles (XML and Annotation) with architecture/flow and implementation steps.
  • Write a structured answer comparing two approaches used in this topic.
  • Discuss debugging strategy for this topic with likely failure points.

Practice Task


  • Implement: Apply logging aspect and compare XML vs annotation config.
  • Add console/log output to validate flow step-by-step.
  • Document one bug you encountered and the exact fix.

Checklist


Can you:

  • explain AOP & Bean Configuration Styles (XML and Annotation) in your own words?
  • implement a basic example end-to-end?
  • identify and fix one common runtime issue?

Next Lecture


  • Topic: Lecture 33 - Spring Boot Configuration & Setup
  • Preparation required: revise this lecture summary and code walkthrough

Questions?

Next: Lecture 33