I thought EJB container is on all servers(like Glassfish, Tomcat, JBoss).
You think that to build good website I need Spring instead of EJB.
Does Spring do handling transaction, concurrency, interceptors, security by default as EJB?
Does Spring allow stateless , stateful and singleton beans?
If you are aware of the old entity ejb bean, you know how painful ejbs are a few years ago.
Spring flourished due to stuff like that.
Spring grew not just as a complement or complete replacement to EJBs.
In the Spring reference pdf (for Spring 3.0.7), it mentions only 1 scenario where you may need to use EJB instead:
The Spring Framework does not support propagation of transaction contexts across remote calls, as do
high-end application servers. If you need this feature, we recommend that you use EJB. However,
consider carefully before using such a feature, because normally, one does not want transactions to
span remote calls.
Everything you mentioned (transactions, etc.) can all be done in Spring. Spring is a huge framework now. Try read a wiki on Spring or anything and you will see.
Just to add, java now supports injection of some sort, similar to Spring, but not yet as much.
Probably it is better to use Spring to build cool websites than EJB.
I only study JavaEE now.
I covered Antonio Goncalves 'Beginning JavaEE6 with Glassfish' and javaee tutorial completely.
I decided to develop my own cool website like javaranch. Now I see that EJB (I use) is for enterprise app but not for websites.
Can you give me example (better link) of enterprise application with EJB, JPA, JSF? I shall try to develop your example after I finish current website.
I am learning Java for 2 years and nobody has given me any task. I have been rejected for about 10 times.
It happened because I did not learn single technology but was jumping from JavaSE to JavaSwing and finally to JavaEE.
A good web site doesn't depend on the technologies being used - it doesn't matter whether you use EJBs or Spring or neither. It depends on doing something that its users need done in an intuitive to use manner. Information design, visual design, performance and scalability are likely to be more important than the underlying technologies.
Ulf Dittmer wrote:It depends on doing something that its users need done in an intuitive to use manner. Information design, visual design, performance and scalability are likely to be more important than the underlying technologies.
True but of course the question arises: how to achieve performance and scalability and stability and security etc. They have to do with the underlying technology.
Joined: Mar 22, 2005
Both EJB and Spring can be used to build scalable and performant web sites, and both can be used to build non-scalable and terribly slow web sites. The same is true if you use neither framework. You need to kow what you're doing, and that's true regardless of the technology being used.