Question

what is the Advantage/disadvantage of use java ee 6 vs spring framework in enterprise application? Which one is better for large scale projects(why)? comparing to java ee 6, what is spring disadvantages ? i dont have any experience in spring but i want to know difference between them.

Was it helpful?

Solution

Java EE s main advantage is that it is an official framework. It has all the same features as Spring except for the fact, that it always goes in one box - container (even if you do not need some components, they will be present). Of course, it is possible to hook some components of Java EE (like Weld) separately into your java SE app, but it is not common.

Spring on the other hand is more configurable in terms of the components you want. You can decide yourself what you need in your application (usually DI). Spring can also use Java EE features (such as JSP).

If you need only some small subset of Java EE (like Dependency Injection), it is better to use Spring for it. If you need multiple features of Java EE (ie. JTA + JMS + DI + etc), I would go for Glassfish.

OTHER TIPS

The main difference is that with spring framework you do not need a full JavaEE container. Otherwise, they are more or less two different solutions for the same problem. I will not comment on the advantage/disadvantage part of the question since this is opinion based.

JavaEE 6 is much more similar to Spring 2/3 than before. The main Spring features / projects has its JavaEE equivalents and you don't need a full JavaEE server to run. You just need the areas you use.

One advantage of Java EE is to code just having the small JavaEE API as a dependency and leave the implementation as responsibility of the server. You don't need a certified server. You can run it in a Tomcat with just the implementations you need. They already did it for you with the TomEE project.

So that's it. If you want to use just java and javax packages instead of org.springframework in your classes you choose JavaEE.

If you don't mind to use non java or javax packages (why would you?), so you can use Spring and any other non Java library.

Both offers solutions for many problems and all the answers in Stackoverflow will be biased. It's not useful to ask that generic question. It depends. What are you goals. Your syntax and usage preferences. Performance requirements. Security requirements… each component can be better, depending on the usage, and you have the option to use both and choose from each one, what helps you best.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top