Filed under: Java
There are several reasons why I prefer not to use SPRING.
1. Spring configuration is bloated.
My team develop enterprise application using Dependency Injection framework. There are more than 1500 classes in that project, and separated to more than 11 modules.To my experience in a real world, “we made service object less then the object who depend on that service”. If we use spring framework when we made 1000 actions who depend in 100 service, it means we have to make configuration on 1000 bean that depend on 100 service. The configuration getting worst if the actions continue growing in numbers, we must very extra carefull when we want to refactor something, we dont want to break existing code. You might start thinkin using autowire by type … no that would be a bad idea. Then … why not using autowire by name, … that sound silly what if we have different name in configuration for different object, well i guess thats gonna be another long nite at the office.
2. Putting configuration into XML is painful.
XML configuration is painful, the context painful is not something concerning how top coder you are, but more on maintenance. If you have 1000 actions then you got to be very aware what and where the configuration taken place in XML, you should have an eagle eye, you must not forget to use tools feature find and replace to change the xml configuration. Otherwise the application will blowup when going on production.
3. You loose Java Strong Type Checking if using XML configuration
When you start using XML configuration, you will loose the power of java. When you lucky the object that you inject into the bean is not what the bean wanted. You have to wait until Spring Start Running and start checking the dependency, at that time you realize you made a silly mistake. Ouchh ….
Some Configuration not using XML but in Java class, in GUICE you use module, If we want flexibility, we still can achieved by separate the business logic jar into another archive, and in the core jar we just put Class.forname(“the module class”). Thats all
4. Spring is not light weight container.
Unfortunately spring is not light weight anymore. Today Spring performance is not the fastest anymore, there are more lightweight container exist out there where the performance is better.
5. Spring is a Container that promise us to build loosely coupled application.
Spring is a container that just promise us to build loosely coupled technology, spring does not really concern that much about tightly coupled. I’m very sure that once we use spring lib other than spring-core.jar that means our application cannot live without spring.
70 Comments so far
Leave a comment
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
>> 5. Spring is a Container that promise us to build loosely
>> coupled application.
>> Spring is a container that just promise us to build loosely
>> coupled technology, spring does not really concern that much
>> about tightly coupled. I’m very sure that once we use spring
>> lib other than spring-core.jar that means our application
>> cannot live without spring.
Yup, I agree if we face conditions that we think that our application must be portable between different IOC Container (then you must avoid some of features that couple your application to spring) but not avoid all features in Spring.
Comment by erixadams July 2, 2007 @ 5:47 amI think spring rock!
Comment by Eko SW July 2, 2007 @ 10:14 amwe made an application worth 60 million.Unfortunatley it was built on Portlets.It was scrapped.
Is Spring on the same track?…No idea…..
Comment by nitinrohidas July 2, 2007 @ 11:07 amRegarding 1/2/3
You don’t have to use XML configuration there are multiple options to configuring Spring. Annotations, XML, JavaConfig or use the Spring low-level-api yourselves. When you leave the realm of XML configuration you will be able to have strong typed back, no large xml files.
Regarding 4
Depends on what you want to use of Spring, if you want to use only DI and maybe some utility classes Spring is quite lightweight, if you want to use something more Spring becomes a bit more heavy. The only lag we experience is the 30 seconds startup time of tomcat, however this is mainly due to our database connection setup.
Regarding 5
Which features are you talking about? We use Spring transactions, aop support, without any hard reference to Spring? If you use Spring MVC your web-layer is referencing Spring, however you lower service/business/dao layer can stay clear of Spring.
Also as of Spring 2.0.x it is recommended that if you use Hibernate/JPA that you don’t use the Hibernate-/JPATemplate approach anymore. But the normal recommended approach (for Hibernate that is the currentSession approach), this doesn’t tie your dao layer to Spring in any regards.
Comment by Marten Deinum July 2, 2007 @ 12:16 pmerixadams
Yep you got the point
eko sw
hmmm …. i was thinking like that too
nitinrohidas
Time will tell
Marten Deinum
You don’t have to use XML configuration there are multiple options to configuring Spring. Annotations, XML, JavaConfig or use the Spring low-level-api yourselves. When you leave the realm of XML configuration you will be able to have strong typed back, no large xml files.
Well Id say I don’t like Spring Java Config and Spring XML Config in such a fashion because those configuration is bloated !!!. Spring Java config is another reincarnation of Spring XML config. The different part is in spring java config you use Java so the type checking does apply, but not reducing the amount of code that you should create ! no large xml files but you still found mountain of java config code.
Depends on what you want to use of Spring, if you want to use only DI and maybe some utility classes Spring is quite lightweight, if you want to use something more Spring becomes a bit more heavy. The only lag we experience is the 30 seconds startup time of tomcat, however this is mainly due to our database connection setup.
im just saying Spring is not light weight anymore there are other framework does perform much much better than spring. 
Comment by gorif July 3, 2007 @ 7:03 amIf you mention 30 seconds, that is too subjective, if other framework can perform in only 5 seconds instead. Ill choose other, the reason is simple … I need good performance application. In mission critical application a second means a lot.
>Well Id say I don’t like Spring Java Config and Spring XML
>Config in such a fashion because those configuration is
>bloated !!!. Spring Java config is another reincarnation of
>Spring XML config. The different part is in spring java config
>you use Java so the type checking does apply, but not
>reducing the amount of code that you should create ! no
>large xml files but you still found mountain of java config
>code.
What about annotations? More precise: What do you really expect? There has to be some configuration, stuff won’t happen by magic.
>:) im just saying Spring is not light weight anymore there
>are other framework does perform much much better than
>spring.
Name one, up to now you’ve just been hinting about that super fast and easy to configure framework.
>If you mention 30 seconds, that is too subjective, if other
>framework can perform in only 5 seconds instead. Ill
>choose other, the reason is simple … I need good
>performance application. In mission critical application a
>second means a lot.
He was talking about startup time… besides, I don’t think you can cut down on DB connect time by using another framework.
Hoogla Boogla
Comment by Hoogla Boogla July 3, 2007 @ 3:39 pmthe only point i agree is 4.
A more lightweight container is: hivemind : http://hivemind.apache.org/
http://gpitech.wordpress.com/
Comment by Santiago Urrizola July 3, 2007 @ 4:10 pmHoogla Boogla,
Guice has been described as MUCH faster than Spring. Of course, all it does is DI, so it may not be appropriate everywhere Spring is, but if all you need is DI…
Jason Lee
Comment by Jason Lee July 3, 2007 @ 4:27 pm1) You always have a minimum amount of configuration. And if you like to keep your application flexible, there is no other way then just do keep it configurable. So if you have 1k Actions and 100 Services and you want to keep them flexible, you’ll need to configure them – there’s no way around that! Reduction of complexity has a limit. And in my opinion, this limit is designed by Spring and it is proven thousand time!
With annotations, you also end up with nearly the same size of configuration, but as the difference to XML, it’s just decentralized, which has advantages and disadvantages, too.
So if your team is not able to handle this large application, you better ask your superior for more backup. Or you have to alter your development process in order to organize your configuration management better (like using tools).
2) Working with XML is just about tools (have a look on Spring-IDE)w! And to me, it makes no difference having complex java code or complex spring configurations. Because I know Spring and I know how to use it to keep my java code clean and less complex instead.
3) Well, I never experienced a problem with that, beside when my apps were misconfigured. But then, the tests and complete build are failing… leads to development management and tools again.
4) Then use it! But beware of the configration issues you have on these other frameworks. Spring has not been a bottleneck to any Spring-based application unless it has been misconfigured.
5) I hope, I do not understand your concern wrong. But in my eyes, spring never had the requirement to be replaceable within the application that needs to wire all these beens to become functional. If so, we need standardizations then (like OSGi – maybe you look for that then).
Under the line: Spring is not to blame for complexity of large projects. If your project has not the requirement to be flexible, then do not use Spring. But if so, you must create a work environment, that can handle large projects in the best possible manner. Because you can not break the limits you have – we do not have the tools to create ready-to-launch applications just having an idea of this application and its configuration. Currently, it must be done physically.
Comment by springer July 3, 2007 @ 4:31 pmI think you’re absolutely right. Spring adds too much complexity to application configuration.
Comment by robfer July 3, 2007 @ 4:34 pmAll spring evangelists talk about unit test and the power of DI for testing your classes. But IMHO a simple straight java code easily readable by human is much more effective to decrease maintenance cost than any junit testing.
Often people that work on a project change and complexity causes the learning path for new developers too slow.
If i were you, i would have come out clearly and pimp Guice. If you like Guice, just be candid about it there is nothing wrong about that. But to try and promote Guice by fudding Spring is not the best way in my opinion to go about it. Some of the points you raise about xml are valid but there are options in configuring Spring. By the way i think there are very large codebases out there that validates Spring. As for me, I’m happily using Spring but if Guice turns out to provide a better alternative, i will gladly switch.
Comment by Metaele July 3, 2007 @ 4:49 pmThis post has the fascinating title!
Comment by younghoe July 3, 2007 @ 4:53 pmIn my experience, ORM’s configuration loading time is the most expensive part of application startup time, and at application run time, the database.
Creating objects isn’t a problem. Even less if you are using Spring, that ease the use of stateless (singleton) objects, that are created just once.
About the dependency on Spring, it is very clear: you depend on it only if you want to. The whole story of externalizing configuration (to XML or Java classes) is about not putting dependencies references (direct or indirect) in your business classes.
With Guice, you necessarily depend on it (import its .jar), because you must annotate attributes/methods with @Inject. Even more, it encourages you to inject dependencies into private fields. This makes it impossible to use it outside the context of some kind of container that is capable of doing it (well, you can use reflection to set them, but…).
Comment by T July 3, 2007 @ 5:16 pmAgreed, Spring is painful. Do you have any suggestions for an alternative to Spring that isn’t clunky and requires less manual configuration?
Comment by syalam July 3, 2007 @ 5:46 pmSpring is many many things.
At it’s heart is a DI container, which starts up *really* quickly…in less than a second.
Yes, the XML can become quite complex, but new namespace support and/or other ways of providing the meta data reduce this. SpringIDE is making great strides (if you use Eclipse).
On top of the DI is a very large number of integration libraries which are invaluable….wiring the client server by using RMI and then by using Burlap or Hessian *without changing any code* is pretty impressive. Same story with message driven POJOs…no code. Or connecting to an existing EJB…no code. Or exporting (or connecting) to a JMX server….no code.
The third layer is the transaction abstraction. Being able to declaratively define my transaction semantics without worrying about whether it is a local or JTA transaction is pretty neat.
And being able to test all of this inside of my favourite IDE? Unbeatable.
As for speed? Yes, Guice *may* be faster (no idea), but Spring isn’t slow. The start up time in Spring is less than a second. If you are configuring database connections, or instantiating a Hibernate SessionFactory, *that* will take as long as it took if you just newed them up.
Add in the fact I can do AOP….unbeatable.
Spring is not just a DI container…..get with the program.
Comment by Me Myself and I July 3, 2007 @ 5:55 pmIt’s clear from your arguments, that you don’t have very much experience using spring and are speaking out of pure ignorance.
Comment by Jack July 3, 2007 @ 11:49 pm[...] 5 Reasons why I think I will not use Spring. There are several reasons why I prefer not to use SPRING. 1. Spring configuration is bloated. My team develop […] [...]
Pingback by Top Posts « WordPress.com July 3, 2007 @ 11:59 pmI’m not sure if I agree with your logic in this post… but I think it is a good idea to carefully consider whether Spring is right for your project or not, as I described in my blog on Dependency Injection
Comment by Java Donkey July 4, 2007 @ 12:48 amIf we use spring framework when we made 1000 actions who depend in 100 service, it means we have to make configuration on 1000 bean that depend on 100 service.
And the alternative is … what?
You have to wait until Spring Start Running and start checking the dependency, at that time you realize you made a silly mistake. Ouchh ….
And when that happens, once, you fix it. It isn’t like this problem crops up after you fix it that single time.
Today Spring performance is not the fastest anymore,
Can you show me some of your own benchmarks that make Spring slow down your applications? If not then you’re just repeating something you read on the interwebs.
Spring is a container that just promise us to build loosely coupled technology, spring does not really concern that much about tightly coupled.
I’m trying to figure out what you’re saying. Are you saying that the loosely coupled-ness that Spring gives you comes at the price of being tied to Spring? I suppose that’s true, but it is like saying you’re being tied to annotations if you start using them. Rarely do my classes extends a Spring class (the exception being Controllers for use on the web) and rarely do you need to have anything Spring-specific in your classes.
Comment by BlogReader July 4, 2007 @ 2:31 amSpring isn’t just about IoC. Its a full stack for writing web and client applications.
However, if you only want to compare the IoC capabilities of Spring, then you are simply talking about the spring-core library, not the spring-full library which is enormous and includes a ton more features. Thanks to the care and effort that the spring developers put into code organization you can use only the modules that you require for your software.
Compare Spring IoC to other frameworks. Specific frameworks, and write a new post.
Comment by Mike July 4, 2007 @ 3:07 am1. Spring based app is hard to debug – it is really difficult to get to the correct bean if you do not know which class is used. Of course you can take a look at XML file, but as I say it just no fast.
2. If you are not the one who was developing it, and there is no up-to-date documentation, the whole Spring based architecture is a lot of pain to understand.
3. Spring requires a big learning curve.
4. When you have many ways to do things, as with Spring – you eventually get it done in a wrong way.
5. XML is hell to write and to maintain.
6. Why would anyone want to easily switch from say Hibernate to iBatis? How many projects require such flexible configurations?
7. You still do the same things but not in Java using a great IDE such as Eclipse with error-checking and stuff, but in an ugly XML.
Comment by HRM July 4, 2007 @ 5:35 amRegarding #5, I am agree to BlogReader. Spring team has done a good work in modularizing their library. Beside, I don’t mind to ‘tie my code’ to Spring (or some other libraries) as long as it gives value to me. It’s analogous to every java code which is ‘tied to JDK libraries’. If we can put aside the fact that these codes are coming from JDK, than we’ll be faced to the decision whether it gives value to us.
Spring will always be a controversy, because of its initial statement that we can have Java EE without EJB. People will always remember that and will come to Spring team to ask for their promise that Spring is lightweight. It’s like they have set the “high” bar that they need to fulfill.
My opinion about Spring is it’s a framework that helps you to code in a right manner (although still many people doesn’t get that), makes it look more elegant. It tries to make a common approach on the way we use various library (ORM, JMS, etc) in various layer. Isn’t that good compared to each company has its own unstructured/unmaintained/untested/undocumented/single-person-owned library. (Note that you can always choose not to use these “bloated” extensions if you decide to only use Spring IoC, and make your own integration code)
Comment by Jecki July 4, 2007 @ 6:06 amAnyway, the spring doesn’t eliminate ‘unstructured/unmaintained/untested’ stuff from happening. And with aspect injection things just getting worse, it really becomes ’single-person-owned&maintained’ code, a total nightmare if not documented, and usually it is not documented
Comment by HRM July 4, 2007 @ 6:10 amIn reply to HRM:
1. Is it ‘Spring based app’ or is it ‘Your app’ that is hard to debug. Many thought that they won’t get problem if they use spring in ANY way. So they use spring in the “wrong” way and expect it to return good results. Like always, you can choose not to use XML, if only you know about that.
2. It’s a problem of “non-documented application”. Irrelevant.
3. Yes, it is. It requires so because it tries to carry you to a higher level (abstraction) thinking.
4. Yes, if you don’t know how to do things. Beside, Spring has a large community which you can share and learn with.
5. Yes, that’s why Spring now came with JavaConfig. Domain Specific Language is also an alternative. But IMO there’s a limit in the way we reduce complexity, because complex business model will somehow reflect in your code. If it’s so simple than it will mostly be a “hello world” application
.
6. Agree. Library switching is not an easy decision. No body seems to care a lot about these when they decide to choose Spring as their framework, at least I don’t.
7. You can always choose other mechanism instead of XML.
Comment by Jecki July 4, 2007 @ 6:25 amJudging by the picture at the top you like autumn better than spring
Comment by fauigerzigerk July 4, 2007 @ 8:07 amThis is so lame.
IoC is just a small part of Spring. The rest is AOP and integration with lot of different technologies.
Spring is slow? Mind elaborating on this one? In my experience, what’s really slow is the hibernate initialization. The rest comes up really quickly.
Also I don’t see how Spring forces your code to be depending on Spring. The whole point of IoC is to reduce this dependency.
I’m not very fond of xml. In fact, since had to write wsdl files by hand, i can say that in general I strongly dislike writing xml. Fortunately the xml config of spring is rather sane and I can live with it.
Comment by Matej Knopp July 4, 2007 @ 12:26 pm[...] Coincidindo com a pouca empolgação com o framework, li um artigo publicado por Arif Rachim com o sugestivo título de “5 Reasons why I think I will not use Spring”, contendo uma análise sobre o uso do Spring (leia o artigo completo aqui). [...]
Pingback by Blog - Jarley Nóbrega » Spring framework July 4, 2007 @ 2:16 pmThe author’s profile says:
Passion: To Simplify Java Development
Comment by Mike July 4, 2007 @ 2:19 pmHRM said:
“6. Why would anyone want to easily switch from say Hibernate to iBatis? How many projects require such flexible configurations?”
What are you talking about here? You mean we’re encapsulating the database access under dao/service interfaces and we want to switch the ORM underneath? That’s not a Spring’s concern.
Comment by Rubén Barroso July 4, 2007 @ 2:24 pm1. Spring configuration is bloated.
Things that used to end up in code are now externalized in configuration. Not a bad thing.
Application context files can be broken up into pieces, just like the rest of your app can be layered.
You’ve got to say it somewhere, whether it’s a call to “new” or configuration of the bean factory.
2. Putting configuration into XML is painful.
I don’t find it to be so. This is simply your opinion. Interface 21 has put effort into responding to this admittedly
common criticism by using more annotations in Spring 2.0 and 2.1.
An IDE like IntelliJ not only makes it easy to maintain XML configuration files, it’s smart enough to cross-check it with the classes in your app. Maybe you just need to get a better IDE.
You don’t say what your preferred alternative is. Do you like hardcoding everything in your source more?
3. You loose Java Strong Type Checking if using XML configuration
I don’t agree. Spring encourages the use of interfaces, which is also a Java best practice. When you inject a particular implementation behind a Java interface, you’re taking advantage of the best of object-oriented programming (encapsulation and information hiding). Why do you have to know the runtime type of the implementation class? Why isn’t the compile-time
interface type sufficient?
4. Spring is not light weight container.
Not fastest? Data, please.
Do you mean “fastest to start up”? Personally, I don’t care. I find that using Spring with Tomcat, Jetty, or WebLogic with
IntelliJ is more than adequate. I never find myself saying “It’s already been five seconds – why does Spring take so long to start?”
“Fastest in production”? Compared to what? Data, please.
If it’s Guice or another DI framework, that’s fine. I think Spring is providing a lot more value that just being
the fastest to start.
Spring has always been heavier than PicoContainer. But Spring is more than DI – it’s AOP and a library of exceptional
plumbing classes that you can use. I get to leverage the crystalized experiences of a team of top-notch, experienced
consultants and developers. Their best practices tend to mean no memory leaks, no dangling resources, no lost database connections, and well-layered code.
5. Spring is a Container that promise us to build loosely coupled application.
What? Is this a criticism? Do you find that Spring makes your apps tightly coupled?
You can write bad code in any language, with any framework. I’m sure it’s possible to make a huge mess with Spring. I just haven’t seen it yet.
PS – It’s “You lose Java Strong Type Checking if using XML configuration” Both your spelling and arguments leave a
Comment by duffymo July 4, 2007 @ 2:29 pmgreat deal to be desired.
Hey man, probably you have never created an enterprise application using Spring.
Spring rox!
About XML? common guy, xml is easy, it’s better than use a lot of annotations.
Cheers,
Dalton Camargo
Comment by Dalton Camargo July 4, 2007 @ 2:59 pmhttp://www.javabb.org
You must check Mentawai: http://www.mentaframework.org/
I agree with you. It all comes to a matter of how simple you want to be and how big is your system. Many, many systems are using Spring but they really do not need Spring.
-Sergio
Comment by Sergio Oliveira July 4, 2007 @ 4:05 pmI am very convinced that nothing can bit the programmatic configuration when it comes to being natural, flexibility, power, joy and simpleness.
Mentawai was the first to introduce this, 2 years ago: instead of XML/Annotation, let’s use Java.
http://www.mentaframework.org/
Comment by Sergio Oliveira July 4, 2007 @ 4:09 pmHRM If you are not the one who was developing it, and there is no up-to-date documentation, the whole Spring based architecture is a lot of pain to understand.
You can s/Spring/whatever/g and the statement will still be true, which means that this point means nothing.
Perhaps it would be better if you could explain exactly what’s wrong and how other ways of doing it are better. Do you think a homegrown framework is better? Good luck interviewing people with experience in the FooBar framework.
Comment by BlogReader July 4, 2007 @ 4:14 pmHi gorif,
Every decision you make as both an upside and a downside.
I haven’t read anywhere stated that Spring should be used everywhere and anytime. It works as a tactic for achieving certain qualities you want in your software, you may use others.
All the reasons you’ve stated are valid in that particular context but possibly not in others, meaning that you shouldn’t use Spring there but you should in other cases.
Also for all the reasons you’ve mentioned it’s possible to find one that makes you think you should use Spring
.
As everything in life there are no solutions, only compromises.
Comment by Sergio Correia July 4, 2007 @ 4:48 pmInteresting reasons for “why not to use it”, but he is not saying “i use X framework because it solves my problems”.
On the other hand “1500 classes in that project, and separated to more than 11 modules” … exposing 1500 classes sounds a bit strange, i cannot comment as there is no description of the problem being solved, but putting a hand up in the air, i think there is over-engineering and/or scope creep from the techies !
Comment by Joshua Cornejo July 4, 2007 @ 9:49 pmUsing xml configuration does not necesarily mean you do not have strong type checking. If you use spring ide it will detect any error in your config. For example if the class of a bean does not conform to an interface that is used in a property of a bean that uses it.
The most current version of spring ide even starts to support refectoring. So if you change a class name your spring config will follow.
In any case I would not recommend using spring without spring ide.
Comment by Christian Schneider July 4, 2007 @ 10:22 pm[...] 5 Reasons why I think I will not use Spring. [...]
Pingback by WordPress Wednesday News: WordCamp Filling Up Fast, WordPress 2.2.1 Mandatory Upgrade, Hot WordPress Themes and Plugins, WordPress Security, and WordPress Nerds Blog Naked : The Blog Herald July 5, 2007 @ 12:35 am1. Spring based app is hard to debug – it is really difficult to get to the correct bean if you do not know which class is used. Of course you can take a look at XML file, but as I say it just no fast.
If you write codes depend on classes there is no such difficulty in using Spring! And if you write codes depend on interfaces, you gain much and maybe also such a difficulty!
2. If you are not the one who was developing it, and there is no up-to-date documentation, the whole Spring based architecture is a lot of pain to understand.
I am not a Spring developer, but I know that full Spring documentation is included in its distribution, so there is nothing to fear!
You must not understand Spring’s architecture, you must understand your application’s architecture! Spring does not force you to use some kind of architecture!
3. Spring requires a big learning curve.
A big learning curve?! If you just want to use the DI then there is just an hour learning curve! If you want to use AOP and other stuff, then you must spend some time for them even without Spring! Or you must develop and test all things in your team!
4. When you have many ways to do things, as with Spring – you eventually get it done in a wrong way.
You can always re-invent the wheel!
5. XML is hell to write and to maintain.
Use the tools!
6. Why would anyone want to easily switch from say Hibernate to iBatis? How many projects require such flexible configurations?
Well I did that! but not completely switching, but just for some parts, and Spring let me to integrate iBATIS and Hibernate in the same project, and do the data access using different tools within the same transaction and same connection without using an heavyweight container such as WebLogic.
7. You still do the same things but not in Java using a great IDE such as Eclipse with error-checking and stuff, but in an ugly XML.
Use Spring’s transaction management, AOP, JMX, JMS, JNDI and …! Do you really do the same thing? Write the same amount of code? That’s bullsh..!
Comment by Amir Pashazadeh July 5, 2007 @ 9:32 am1. Spring configuration is bloated.
My team develop enterprise application using Dependency Injection framework. There are more than 1500 classes in that project, and separated to more than 11 modules….
Which framework can do the stuff for you? If you have naming conventions in your project (and team) then you can use autowiring easily, and if you don’t then that’s a shame for a team developing a huge project.
2. Putting configuration into XML is painful.
XML configuration is painful, the context painful is not something concerning how top coder you are, but more on maintenance…
Use the tools! and good documentations (even with Spring’s BeanDoc)
3. You loose Java Strong Type Checking if using XML configuration
When you start using XML configuration, you will loose the power of java. When you lucky the object that you inject into the bean is not what the bean wanted…
The same problem with annotations, and other stuff, or you can hard wire your classes and don’t use any DI!
Some Configuration not using XML but in Java class, in GUICE you use module, If we want flexibility, we still can achieved by separate the business logic jar into another archive, and in the core jar we just put Class.forname(”the module class”). Thats all
Can’t you do that with Spring!? and what does GUICE do for you then?
4. Spring is not light weight container.
Unfortunately spring is not light weight anymore. Today Spring performance is not the fastest anymore, there are more lightweight container exist out there where the performance is better.
Use only the DI and compare it with other frameworks! Please give the benchmarks, otherwise all you said are just bullsh.t!
5. Spring is a Container that promise us to build loosely coupled application.
Spring is a container that just promise us to build loosely coupled technology, spring does not really concern that much about tightly coupled….
If you understand Spring you don’t need any coupling to it except for the Web MVC!
And if I write an application using Hibernate my application is tied to Hibernate lol
Comment by Amir Pashazadeh July 5, 2007 @ 9:45 amif I write an application using Struts my application would be tied to Struts lol
if I write an application using Servlets my application would be tied to Servlets! lol
Very interesting post, especially with the comments. In some senses Spring is a victim of it’s own success: but even if it about to be replaced with better technology one cannot get away from it’s contribution the Java community. Despite any issues one might find with spring it has become the POJO framework of choice as as such third party components: Axis, Tangosol, Mule, Terracotta… in fact the list is too many to mention. All integrate with Spring. It seems to me while everyone else has been creating IoC containers with “better” configuration, the Spring community has been forging links with other commercial and OSS frameworks to better integrate. Even Guise, which some prefer to Spring for IOC, has Spring integration arguable to take advantage of the Portable Service Abstractions available (and even as noted in the Guise documentation Annotation Driven Transactions— Spring-AOP)
So you might have five reasons not to use Spring: we all have reasons not to use something. How long is your list for using spring? Five sounds like a low number of issues considering the leverage that Spring potentially offers.
Even if one still think Spring is inferior to another technology, that isn’t necessarily a reason not to select it. It is naive to select a technology that has no community or is unlikely to survive. This creates a maintenance issue. Considering Spring seems to be making its way into some of the next generation Application Servers (Websphere for instance). The fact it’s not disappearing any time soon means it’s a safe bet for the future of your application. Like it or not.
Comment by Andy July 5, 2007 @ 11:54 amYawn…
point 1 – Use decent IDE. Both Idea and Eclipse + SpringIDE cover that “extra very careful” refactoring challenge.
point 2 – Use spring 2.0 namespace support and put your configuration in some other format, don’t use xml, etc. This is not a reason in my book. See point 1 above and write some brain dead unit tests that load your config and alert you to the problems BEFORE production.
point 3 – see point 1. USE DECENT IDE already
point 4 – Ah? Are you going to switch between IOC frameworks any time soon? This is not making sense at all
point 5 – What are you talking about?
All in all, ask around to learn better strategies in dealing with your chosen frameworks/tools before making immature remarks
Dmitry
Comment by Dmitry July 5, 2007 @ 2:29 pmI thinking if this is just a case of not fully understanding the capability of the tool one is using plus not correctly using a tool in a way it’s meant to be used.
Comment by David Lim July 6, 2007 @ 4:00 amI would like to know from Arif on the alternative solution he recommends using in place of Spring container.
Comment by Dilip Viswanath July 6, 2007 @ 12:51 pm[...] gibt hier einen interessanten Blog-Post, 5 Reasons why I think I will not use Spring.Gründe gegen Spring?Die Hauptargumente sind die langsame Start-Up Zeit des Containers, die nicht [...]
Pingback by Gründe gegen Spring Framework :: everflux July 7, 2007 @ 10:43 pmOne than I definitely hate about spring is that the inagility it causes. It discourages frequent refactoring.
Comment by Hendry July 9, 2007 @ 4:32 amRefactoring java-code would require you to reflect to the configuration. The best you can do is by find-replace. It uses ad-hoc technique, and obviously, not too robust and efficient. There’s no compile-error as well. Developer tends to hesitate doing refactoring when dealing with spring.
This remains true whether you use javaconfig, xml, properties-based, or annotation.
Frequent Refactoring means that your code is inconsistent. Spring is suggesting a better way of coding. Write them in interface, interface is like a contract and it should not get refactored like 2 times a day.
I agree with all springsters as i am one of them, Spring is more than just a DI Container, its a J2EE framework, doing more than just a mere DI. If you dont like spring, go ahead and write your guice modules and maintain it yourself.
Comment by Andre July 10, 2007 @ 6:47 amWho ever said that you have to use DI on every bean in your application. Of course if you do that, your configuration will get bloated, but that doesn’t mean that Spring is definitely bad, perhaps you need to rethink your design and modularization. Perhaps it would be wiser to have a nice separation of concerns between your application parts/modules, each module having a clearly defined interface, and then try to link only those interfaces with spring. That would probably bring more value out of the DI that spring has to offer and also keep your configuration clearer and easier to maintain.
Comment by Mihai Campean July 11, 2007 @ 7:26 am6-It dose not support State concept!!!!
Comment by Hashem July 11, 2007 @ 9:48 amcould you guys decide on one good framework.. damn java development..
good old legacy days..
Comment by mk July 11, 2007 @ 4:53 pmI seriously don’t understand what you all are discussing, but it looks like a nice place to retire!
Comment by Kit July 13, 2007 @ 10:24 am[...] http://gorif.wordpress.com/2007/07/01/5-reasons-why-i-think-i-will-not-use-spring/ [...]
Pingback by 5 razones para no utilizar Spring | PROGRAMACION July 30, 2007 @ 10:57 am[...] tiempo Luis me envío este artículo y la verdad es que me dejó bastante mal ya que soy un fiel defensor de Spring, pero por otro lado [...]
Pingback by 5 razones para no utilizar Spring | orientada a aspectos August 7, 2007 @ 7:51 am[...] หัวข้อ 5 Reasons why I think I will not use Spring. There are several reasons why I prefer not to use [...]
Pingback by 5 เหตุผล ทำไม ? ที่จะไม่ใช้ Spring « iDome ‘ Blog August 7, 2007 @ 5:00 pm[...] 7 08 2007 ช่วงนี้ไม่มีเวลามาบล๊ิอกเลยครับงานยุ่งมาก ๆ มีหลายอย่างที่ต้องทำในช่วงนี้ ตอนนี้มีเหตุจำเป็นบางอย่างที่ทำให้ผมไม่อยากใช้ spring เลยไปค้นเจอใน internet ชอบใจมากเพราะบางตรงกับความคิดเรา หัวข้อ 5 Reasons why I think I will not use Spring. [...]
Pingback by iDome ‘ Blog August 7, 2007 @ 5:02 pmNumber 6:
#6- Is a copy of others wel-know frameworks … like JSF
Comment by Fred August 16, 2007 @ 5:43 pm[...] Achei um blog na internet onde o desenvolvedor falar de cinco razões para não utilizar o Spring Framework. Pra quem desenvolve em Java para Web sabe se tem um probleminha na hora de configurar os arquivos xml. Bom, acho melhor vc ler pra ver e refletir. [...]
Pingback by Web4u - Web for You » Blog Archive » Sobre Spring Framework August 18, 2007 @ 1:52 pmTapestry 5 is the answer to Spring these days :-d
Comment by Joshua Jackson August 24, 2007 @ 7:34 amI thought the Java community was promoting EJB, Enterprise Java Beans the greatest thing since sliced bread. Yet now the same people are coming through with this framework, almost as a reaction to the very framework they first supported, EJB!
I used Spring, it was a pain in my azz, that’s my honest assessment of it. Just like creating three files for every class was a pain when I had to do EJB. Enough with the nonsense, the best Java I’ve seen to date is POJO!
The Java community has so many followers it’s absurd.
Comment by geber22 March 18, 2008 @ 10:26 pmlike everything Spring started a good idea and now is bloated.
the best approach to building large scalable j2ee apps is I believe
struts for the presenation layer
Stateless Session Beans – to manage business services, transaction mgmt and as an entry point for web layer
hibernate – persistant layer
appropitate patterns to seperate these three layers.
Comment by mahela March 21, 2008 @ 11:04 pmAgreed with Hendry (46): if you develop iteratively and you don’t know the complete domain of application (such as in product development), you’ll have to change the interfaces of your components frequently in the first few iterations of your development process.
Maybe it’s a good idea to start introducing Spring in a more stable stage of the development in such a case.
I have heard more times about failed or out-of-date delivered Spring-based projects cases than successful ones (small ones). In most of these cases, people used Spring in early stages of the development, when they don’t really needed the solutions or flexibility Spring provides.
The real problem is when customers suffer this. They mistakely group plain Java development with Spring development and start preferring other technologies: php, .NET. So sad, since I think Java could do anything those technologies can do and much much more (including things they still can’t do).
Just another opinion. Regards.
Comment by Koko June 26, 2008 @ 1:24 amExtracted from http://www.springframework.org/about
“J2EE should be easier to use” why? distributed processing and large scaled systems are not easy to develop, are they? Unless you want use JEE’s advanced features to develop even a helloworld web app. Which is a common practice among Spring developers. Hehehe…
“It is best to program to interfaces, rather than classes. Spring reduces the complexity cost of using interfaces to zero” why it is best? what cost? yeah… Eclipse can “extract interfaces” if you want…. in compile-time!
“JavaBeans offer a great way of configuring applications” agreed! Great for anything involving pure data, indeed.
“OO design is more important than any implementation technology, such as J2EE” as pholosophy is to building houses. At some point, you have to deliver your software, so forget your idea of modeling the universe in your application… yeah, sorry guys, that’s impossible.
“Checked exceptions are overused in Java. A framework shouldn’t force you to catch exceptions you’re unlikely to be able to recover from” what??!!!! What’s next?”So frameworks should know how to divide by zero”. I think you will want to know what happened. This is worst than catching to e.printStackTrace(). Please, keep throwing and catching! Remember that try-cath-finally sentences are as important as if and for sentences for program semantics!!
“Testability is essential, and a framework such as Spring should help make your code easier to test” yeah, it is essential. Any framework should!
Bye! Keep keeping it simple, guys!
Comment by surewhynot June 26, 2008 @ 3:16 amnice post bro. come on, hang out @ jakarta!
Comment by aji August 7, 2008 @ 3:52 pmfor me, i use spring with minimum config xml… i use spring context xml + spring Tx interceptor + CGLib enhancer + Service locator pattern…
in this way instead of having to list 1000 DAO + 200 Service beans + 300 bizz objects all in xml ( what a hell it will be), only Tx mgr + myDataSource + superDao is required to list in the xml…. all my 1000 DAOs are subclassed from this superDao.
thanks to great CGLib / AOP…….
I wish the day Sun can make the java.lang.Object having the similar method of CGLib enhancer….
Comment by john wang August 8, 2008 @ 8:00 pmSpring and Hibernate both suck, and are for programmers that refuse to learn how to program. You spend all your time learning the latest trends and then someone else has to come in an take care of the mess you left behind. Grow up and learn how to program.
Performance :!
Maintenance :!
Re-usability :!
Domain Driven Design :!
Your like the kid who still thinks everyone else should clean up their mess in the kitchen.
Comment by George October 15, 2008 @ 5:20 pmJava programming can be fun! I don’t like frameworks, spring or hibernate. They just seem to slow things down – many things. Performance, the application to be delivered to customer and myself.
All of you spring fans, have fun with spring! (Seriously! If it’s your way, it is…)
All of you java programmers, who don’t like spring/hibernate: they are not for speeding things up. While people is investing in learning frameworks (actually learning to deal with framework-specific Exceptions), I’ve already written the thing required for the customer. With plain old java objects. And it was fun! Done it my way with my existing self-explanatory java code library. I think it’s more fun to write java, than study the latest framework trend.
All the best,
Johnny
Comment by Johnny F. Young November 20, 2008 @ 6:25 pmI worked briefly on a project with Spring and Hivemind and found it very difficult to follow the logic of anything I personally didn’t work on. What we were doing was relatively small and simple so these frameworks added tremendous overhead in reading other’s code. It seems like extreme overkill to me, and I would extrapolate that to even larger projects I’ve done.
Comment by Cecil January 18, 2009 @ 7:46 pmYep. Oracle bought out Sun. Sun has been looking for a buyer for quite some time after the .com bust. apparently their j2ee technologies really suck. They have gotten to the point of being so cheap (since their whole array of technology sucks hardware etc). Good luck to all Java/J2ee/framework delusioned evangalists.
Comment by j2ee sucks April 27, 2009 @ 5:19 pmi don’t like frameworks. I never use one
i love to use just plain servlets ,jsp and jdbc connection.
More easy to me.
Comment by donairl July 23, 2009 @ 8:54 amI agree, Spring is too complicated.
For people who favour XML configs & complexity – Go figure out other world of programming.
No RAD with spring, too complex for simple applications & too becomes too complicated for big applications. The result – spend more money maintaining it & get worse.
A framework should make life easy & faster development time. If you have complex items, you can use plugins to overcome.
Look at springframework.org, you guys will love it. I use Spring + Hibernate for medium sized apps – its fairly straight forward & very easy to work with. We develop modules like piece o cake.
Comment by StripesLove August 21, 2009 @ 3:13 pm