O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

XML-based configuration

The XML-based configuration has been the primary configuration technique since Spring started. In this section, we will see the same example as we discussed in the DI pattern, and see how the CustomerService object is injected in the BankingService class through an XML-based configuration.

For an XML-based configuration, we need to create an applicationContext.xml file with a <beans> element. The Spring container must be able to manage one or more beans in the application. Beans are described using the <bean> element inside a top-level <beans> element.

Following is the applicationContext.xml file:

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required