Spring XML Configuration using Setter Injection :

  • Java 8 or above
  • Spring framework 5.0.0 RELEASE (5.X)
  • Eclipse IDE (spring sts-3.9.X.RELEASE IDE is preferred)
  • Apache maven as the build tool
Figure 1 : Maven Project Structure
Figure 2 : pom.xml file
Figure 3 : CarManufacturer Model Class
Figure 4 : Repository Implementation class
Figure 5 : Extracted interface from the implementation
Figure 6 : Service Implementation Class without Spring
  • Setter Injection
  • Constructor Injection
Figure 7 : Service Implementation Class with Spring
Figure 8 : CarManufacturerService Interface
Figure 9 : applicationContext.xml File
Figure 10 : ApplicationTest class without Spring
Figure 11 : Application Test class with Spring

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vindya Gunawardana

Vindya Gunawardana

Technology Enthusiast, Software Engineer, Java Lover