Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt
hiddentrue

Service Methods for Backend Calls


Overview

There is normally only one service class per app. The service class' job is to get data from the back end and perform some biz logic on it and return it to the front end (actions). There should be one service interface and one class that implements it, e.g. OasSkeletonService, and OasSkeletonServiceImpl. This allows us an easy method to swap the SAP implementation with a Mock implementation for testing purposes. See the applicationContext.xml for information on how to do this swapping.

...

The service spring beans are configured in applicationContext.xml (not in action-servlet.xml) as singletons. Because of this, there should be no instance variables defined for your service other than static variables that you intend to be accessed across threads (users). For instance, in the example below, a static variable, log, is defined. This means all users will write to the same log file which is the behavior you want.

convertRFCMessage