How to do it...

With ch02-xml, let us demonstrate how Spring loads objects using the XML-based ApplicationContext container:

  1. Create a package org.packt.starter.ioc.model, where our model classes will be placed. Our model classes will be typical Plain Old Java Objects (POJO), for which the Spring 5.0 architecture is known.
  2. Inside the newly created package, create the classes Employee and Department, which contain the following blueprints:
public class Employee { private String firstName; private String lastName; private Date birthdate; private Integer age; private Double salary; private String position; private Department dept; public Employee(){ System.out.println(" an employee is created."); } public Employee(String firstName, String lastName, ...

Get Spring 5.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.