Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Profiles

Another interesting feature that Spring 3.1 brings to us as developers is the concept of configuration profiles. Basically, a profile instructs Spring to configure only the ApplicationContext that was defined when the specified profile was active. In this section we’ll demonstrate the usage of profiles in a simple program.

An Example of Using the Spring Profiles Feature

Let’s say there is a service called FoodProviderService that is responsible for providing food to schools, including kindergarten and high school. The FoodProviderService interface has only one method called provideLunchSet(), which will produce the lunch set to each student for the calling school. A lunch set is a list of Food objects, which is very simple class that has only a name attribute. Listing 5-49 shows the Food class.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint