Recommended practices

It is recommended that you have different Spring contexts for each of the layers. This helps in separating concerns of each layer. This also helps in unit testing code for the specific layer.

An application context.xml can be used to import contexts from all the layers. This can be context that is loaded when an application is run. Some of the possible spring context names are listed as follows:

  • application-context.xml
  • presentation-context.xml
  • services-context.xml
  • business-context.xml
  • persistence-context.xml

Get Mastering Spring 5.0 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.