4. Spring Sample Project Installation
What It Does
The Spring sample application is the port of the EJB 3 address book demo, minus the HDividedBox feature. As such, the overall description of it is very similar. See EJB 3 demo.
More specifically, this sample illustrates:
- EJB 3 entity beans externalization, via the HibernateExternalizer class, with Gas3 generated ActionScript3 classes.
- Spring bean: The PersonServiceBean class, configured in WEB-INF/conf/applicationContext.xml, uses JpaTemplate and TransactionTemplate Spring classes for persistence operations and is accessible via the GDS SpringServiceFactory factory. See services-config.xml.
- Security settings via the AcegiSecurityService class, see granite-config.xml and WEB-INF/conf/acegiSecurityContext.xml, at two levels; a web-tier security that forbids unauthenticated accesses (see security-constraint in services-config.xml), and a spring-tier security that forbids modification method calls for simple user (@Secured annotations in PersonService).
Requirements
Follow general requirements here, then:
- Download JBoss 4.2+.
- Download org.granite.gas3_1.2.0.zip.
- Download graniteds-spring-ejb3-1.2.0.zip.
Installation & Deployment
Follow these steps:
- Unzip the JBoss binary distribution somewhere on your computer; for example /jboss-4.2.2.GA.
- Unzip the org.granite.gas3_1.2.0.zip archive in your Eclipse plugin directory.
- (Re)start Eclipse, right-click in the Package Explorer view, choose Import, then General / Existing Projects into Workspace, choose Select archive file, browse to graniteds-spring-ejb3-1.2.0.zip, and click on Finish.
- Edit the env.properties file found in the root directory of the graniteds_spring_ejb3 project and adjust the following variables:
# Set 'FLEX_HOME' property to your flex2 sdk installation directory and # 'FLEX_TASKS_JAR' to your flexTasks.jar location. # WARNING: This property must have this exact name ('FLEX_HOME'). FLEX_HOME=/flex_sdk_2 FLEX_TASKS_JAR=${FLEX_HOME}/lib/flexTasks.jar # Set 'JBOSS_HOME' property to your JBoss installation directory and # 'JBOSS_HOME_DEPLOY' to your deploy directory. JBOSS_HOME=/jboss-4.2.2.GA JBOSS_HOME_DEPLOY=${JBOSS_HOME}/server/default/deployThe JBOSS_HOME_DEPLOY variable should be ok without modification.
- Open an Eclipse Ant view (Window / Show View / Ant), drag and drop the build.xml file, found in the root directory of the graniteds_spring_ejb3 project, on it, and double-click the Deploy target. This should compile, package, and deploy the EJB 3 sample application in JBoss.
- Start JBoss (run.bat or run.sh in /jboss-4.2.2.GA/bin).
- Point your browser to http://localhost:8080/graniteds-spring-ejb3/.
You should now see the Spring sample application running.
