2
votes

I'm packaging my app as WAR archive. What are pros/cons of these two approaches:

  1. Keep EJB (beans, entities etc) as separate project and include into WAR as lib (*.jar file - WEB-INF/lib) during build?
  2. Keep everything (ejb-s, jsf beans etc) in one project, so after build all would go to WEB_INF/classes

Is there any performance/security difference? I'm using GlassFish 3.1.1 WebProfile

1

1 Answers

3
votes

There is really no performance/security difference for JARs in /WEB-INF/lib versus classes in /WEB-INF/classes. They end up in the same context and classloader anyway. Perhaps extracting the JAR and loading its classes into memory needs a few milliseconds more, but that's totally negligible.

Only maintainability and reusability is different here. When you put EJBs in a separate project, then you can more easily reuse them for other WARs and purposes without the need to copypaste classes.