What is a configuration file?

A configuration file is an XML file that describes the different classes in the application and how they are linked to one another. XML configuration files can get lengthy and difficult to manage in large projects. Annotation based approach is easier and cleaner.

How are beans configured in the Spring container?

Configuration metadata can be provide in the following ways:

  • XML based configuration: In XML config files, beans are defined using the <bean> tag containing a number of different configuration options. For example, the following XML configuration defines two beans and specifies constructor injection to inject the myDependency bean in myBean.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.