Chapter 5. Project Recipes

Table of Contents

1. Creating Project-level Variables and Constants
2. Changing JPA Providers
3. Changing JTA Providers
4. JSP Aliases
5. Adding Spring Contexts
6. Creating Eclipse-based Skyway Projects
7. Creating Maven-based Skyway Projects
8. Setup an Eclipse Dynamic Web Project for Skyway Builder
9. Manage project classpath dependencies manually

1. Creating Project-level Variables and Constants

PROBLEM

There are occasions when you need to define one or more variables that are shared with all project artifacts. In some cases the variable values can be changed, and in other cases the values are fixed at design-time.

SOLUTION

The Spring DSL supports Spring components (@Component) for storing a set of variables and constants, and a component has a configurable scope.

HOW IT WORKS

In order to create project level variables, the session scope should be used. Spring will make sure that any and all references to this component are to the same component instance for the duration of the HTTP session.

Session-scoped components are used:  

  • sharing data across all project artifacts

  • holding configuration data

  • other sensitive values that should be protected

Since session-scoped components are maintained in a user session, excessive use of them may adversely impact the scalability of your application. Therefore it's generally recommended to use session-scoped components sparingly.