5 ms·
We recently delivered a big integration project using the best of both worlds. 1) Spring Portlet MVC - cause we have to deal with Portlet (don't ask) 2) JAX-R
by edwinnathaniel 15y ago
We recently delivered a big integration project using the best of both worlds.
1) Spring Portlet MVC - cause we have to deal with Portlet (don't ask)
2) JAX-RS client-side - Portlet talks to GlassFish via JAX-RS
3) JAX-RS server-side - GlassFish RESTful (this is probably one of the key feature for using JavaEE 6, a simple, straightforward, productive way to create APIs that can return XML or JSON or ATOM or ALL of them easily via annotation). JAX-RS is very similar to Sinatra.
4) JAX-WS client-side - to communicate with 3rd-party systems
5) JAX-WS server-side - to provide services for 3rd-party systems
6) Spring-Data - to reduce writing boilerplate JPA 2.x code (the way Spring Data works is as simple as writing an interface method where the method has the same name to the NamedQuery and Spring will automagically inject bytecode)
7) Spring library to read properties file - no need to write the actual implementation of a class that reads a property file and deal with IO exception abd opening/closing files try-catch-finally. Provide an interface and annotate the interface, set up minimal config and you're done.
8) Apache Derby to test the persistence layer for integration testing
9) Spring Web Test module - this provides HTTP Request/Response mock object so you don't have to construct your own
Other libraries:
10) FlyWay - database migration library that integrates nicely with Spring as well. Flyway is executed when you deploy your EAR/WAR to your App Server container.
11) GSON - Java to JSON object converter written by someone from Google. We send JSON from our Portlet MVC to the front-end that is of a mix between JSP (5-10%) and heavy JS usage.
12) Dozer - Object to Object mapping, very useful if you have to deal with 3rd-party systems that have a subset or superset of your internal/local domain model.
13) Maven - we can build for multiple environment (DEV, UAT, PROD, STAGE, etc), it's easy.
We are quite satisfied with the set-up and I have to say that if you come from Rails background, the only part of the stack that would make you a bit unhappy is the database ORM since ActiveRecord is probably nicer compare to the JPA 2.x/Hibernate/Spring-Data.
We're not using EJB yet but we may use it in the future if we have to use queue via JMS as well. To my knowledge the latest EJB (3.1) helps you a lot to deal with transactional multi-steps operations that include persistence operations and JMS operations on one execution path.
I'd say the code that we have to write is almost as short as Rails when it comes to the business logic part.
Deployment was straight forward: package it up as WAR (or EAR) and deploy it to GlassFish.
The part that we're lacking right now is the front-end. Even though we're not using JS _that_ heavy, we are moving toward that direction and eventually we have to clean it up and start using best-practices (Backbone.js, Underscore.js, and a few other things).
- deleted 15y ago[deleted]