Java Reference
In-Depth Information
Listing 7.4. A portion of the AccountService class in Java
The @Autowired annotation is used by Spring to plug in ( inject ) an instance of a class
implementing the AccountDAO interface into the service class. See the Spring document-
ation [ 2 ] for more details on autowiring.
2 http://mng.bz/m9M3
The service implementation is in Java mostly because there's no great advantage to imple-
menting it in Groovy, though I could easily have done so.
The last piece of the puzzle is the Spring bean configuration file. The configuration in the
book source code uses a combination of XML and a component scan for the repository and
service classes. Again, nothing in it uses Groovy, so I won't present it here. For the record,
the sample uses Spring's <embedded-database> tag to set up a sample H2 database
in memory that is reinitialized on each run. The rest is as described.
Returning now to Groovy, I want to show the Gradle build file in the next listing.
 
Search WWH ::




Custom Search