Article: (Re-)introduction to the Spring Framework

Discussions

News: Article: (Re-)introduction to the Spring Framework

  1. Rod Johnson has updated "Introduction to the Spring Framework," updating it to address Spring 2.5. The revised article brings things up to date with Spring's namespace support in XML configuration, annotations, Spring's test framework, and other enhancements to Spring you absolutely want to know about.
    One of the key benefits of Dependency Injection is that your code can not merely be configured in an environment it does not depend on explicitly, but can benefit from services that were not envisaged at its time of authoring. Thus Spring offers a flexible component model that can offer a variety of value adds for little or no effort. For example:
    1. You can "export" any Spring-managed object as a JMX MBean without writing Java code
    2. Spring Dynamic Modules for OSGi Service Platforms allows Spring to take advantage of the powerful modularization capabilities of OSGi, without business objects needing to depend on OSGi APIs or an OSGi runtime.
    3. Spring's compatibility with the SCA SOA standard makes Spring managed objects "SCA ready." SCA specifies a Spring binding for Java.
    4. Spring integrates with a range of clustering and grid solutions such as GigaSpaces, Oracle Coherence and Terracotta.
    5. Your code can take advantage of Spring’s rich and deepening range of platform integrations, while remaining free of proprietary extensions. For example, in a WebLogic environment, you gain sophisticated transaction monitoring functionality due to the fact that Spring ties into BEA APIs, without writing a line of WebLogic-specific code in your application.
    Spring moves forward rapidly, and development activity is further accelerating, so the range of value adds available continues to grow.

    Threaded Messages (18)

  2. Small issue in example code[ Go to top ]

    Small issue in example code: [code] public class OrderServiceImpl implements OrderService { private OrderRepository orderRepository; @Autowired public JdbcOrderServiceImpl(OrderRepository orderRepo) { this.orderRepository = orderRepo; } // ... } [/code] Hint: JdbcOrderServiceImpl Best regards, Kees
  3. Tried to add code fragment via 'code' bb tags, this seems to be wrong.
  4. this article does not scale properly in firefox, the page is very wide
  5. this article does not scale properly in firefox, the page is very wide
    This seems to happen a lot with TSS. You can scroll to the foot of the page and click on "PRINTER FRIENDLY VERSION" to get a better layout.
  6. this article does not scale properly in firefox, the page is very wide


    This seems to happen a lot with TSS. You can scroll to the foot of the page and click on "PRINTER FRIENDLY VERSION" to get a better layout.
    thanks but still wide, I believe it has got something to do with the quoted stuff
  7. yepm it is the pre tag in the quote, editor hint : prohibit use of pre in comments
  8. same to Opera[ Go to top ]

    me 2, the same to Opera
  9. Personally i really, really dislike the namespaces support in spring - they are pain to create them because xsd's are woefully complex beasts - they are a pain to deploy because many xml parsers do not support namespaces properly - they are a pain to develop with, because when spring complains that its missing a bean, you are left clueless on what tag in a namespace adds that bean to the context Any time you save by using them is more then compensated for by the time you'll spend debugging non trivial issues Of course it can clean up your configuration files quite a bit. While many people seem to like it, i just find myself longing for the simplicity of a "classic" applicationcontext
  10. Namespaces[ Go to top ]

    It seems to me the namespaces support is best for Spring-provided features, such as util, tx and aop, and also for frameworks making use of Spring, such as Mule. I think namespaces should be applied only very judiciously in application code/config, since they can obfuscate the otherwise very straightforward Spring XML. One of the things I've always really liked about Spring (1.x) XML is that it is pretty much the most intuitive and straightforward XML I have come across. Almost any programmer could some to Spring for the first time, read a bean definition, and understand what it is saying. Sure there are many advanced features that require learning from the manual, but most bean definitions are very intuitive. Compare this with for example Hivemind, which I have been using for two years but still don't understand. Regards John Hurst Wellington, New Zealand
  11. 2.5 already?[ Go to top ]

    Why are they so keen for a major upgrade so soon after 2.0? Many people are still only coming to terms with the upgrade from 1.2.9 to 2.0 and then this. Not to mention a list of books only just released that will probably be redundant. It baffles the mind, the Spring team seems intent on pleasing everyone feature-wise and keeping up with the Java language changes, that it is making Spring unattractive for newcomers. Why doesn't Spring do what Struts did and basically fork separate versions, and allowing some of us to be happy without having to upgrade like good little sheep? Now, let's go over that 1 million pages of Spring docs from scratch shall we, don't want to be left behind in the skills department, just in case it comes up at the next contract interview... Please note sarcasm.
  12. Re: 2.5 already?[ Go to top ]

    Point taken - Spring does evolve rapidly at present. However, we do aim for smooth migration paths, not only in terms of backwards compatibility but also with respect to new features fitting into the existing feature set. Check out my blog post on Spring 2.5's configuration approaches: http://blog.interface21.com/main/2007/10/24/spring-25-rc1-is-here-introducing-new-configuration-approaches Juergen
  13. Spring and EJB3[ Go to top ]

    Much of Spring's justification resides in (correct me if I'm wrong but wasn't Spring a result of) addressing the complexity of EJB. Now that EJB3 has moved into the pojo/annotation/zero-config world (about time some might say), how is spring positioning itself in relation to EJB3? Is the argument that a J2EE container is too heavyweight relevant any longer? Why go to all the fuss of spring IOC and AOP to achieve all thos wonderful enterprise services when you can get it straight out of the box with JEE5? How can spring be used to improve/simplify the new EJB3 model? Is spring now focusing more on web/mvc/flow and RIA for relevance? Any thoughts would be appreciated.
  14. Re: Spring and EJB3[ Go to top ]

    Much of Spring's justification resides in (correct me if I'm wrong but wasn't Spring a result of) addressing the complexity of EJB. Now that EJB3 has moved into the pojo/annotation/zero-config world (about time some might say), how is spring positioning itself in relation to EJB3? Is the argument that a J2EE container is too heavyweight relevant any longer? Why go to all the fuss of spring IOC and AOP to achieve all thos wonderful enterprise services when you can get it straight out of the box with JEE5? How can spring be used to improve/simplify the new EJB3 model? Is spring now focusing more on web/mvc/flow and RIA for relevance?

    Any thoughts would be appreciated.
    Good post Marie. I'm also concerned about Spring's position relative to the new, lightweight Java EE 5. It would seem counter-productive to compete against a standard that is more agile and suitable for enterprise development today. This made sense a few years ago in the EJB 2.x days, but by and large Spring has accomplished its goal of providing a lightweight dependency injection container as a compelling alternative to the heavyweight J2EE APIs of the past. I think you touched on a key word - relevance. I think for Spring to remain relevant, it needs to employ the same strategy that got it to where it is today, that is, by focusing on delivering the value that the standard Java EE stack does not provide. In particular, I think it makes sense for Spring to emphasize integration with third-party frameworks, such as Velocity, etc. that represent services not covered by the Java EE specification. Having simple access to these services from within a Java EE environment makes sense, and is quite useful. As for transaction management, persistence, security, messaging, etc. I will stick to the standard Java EE APIs. Spring has been an important part of my Java applications for the past few years, and I hope to continue using it where it makes sense to do so. Socrates saw himself as the "gadfly of Athens", meaning his role was to pester the citizens of the ancient Greek city into thinking for themselves. Spring has been the "gadfly of J2EE", and now that the polis has adjusted, it will be interesting to see the next move from the Interface21 team. Ian Hlavats JSFToolbox for Dreamweaver
  15. Well said[ Go to top ]

    You are right, Spring 3.0 will need to be a soul-searcher. Although 2.x has tried to simplify itself through modules, there is still a whole lot of complexity underneath. I have been reading Spring In Action 2ed, and the early chapter seems to take the official approach of bashing EJB2 as an example of the need for spring IOC etc. Isn't this argument old already? Surprising there is (so far anyway) no mention of EJB3. What I kept thinking to myself during the early example code was "yes, but EJB3 does this and has apparently learned its lessons, where is the new business case for spring beans as enterprise components"?. The arguments make some sense, not all enterprise beans need remoting, transasctions, etc etc. But then there's the issues of pooling beans, resources, security. Surely EE5 is now lightweight enough, and glassfish (FINALLY) a decent container to just go with the EE5 flow? Entity EJB's are also now a dead horse thats been flogged, and buried. No more CMP v BMP arguments (thank goodness). The new JPA integrates very well with JEE, and as Netbeans so readily demonstrates, creating 'entity' beans from a database table is as easy as can be. SO where can spring come in to leverage or assist? I no longer want an alternative to the standard, but any added value is always a bonus. Does spring see itself taking advantage of the new JSE6 pluggable annotations capability? Maybe thats a direction for Spring: value added pluggable addons for better productivity. I was also thinking: wouldn't it be great if you could inject EJB3 beans. Can this be done? Probably can, but JEE5 components don't need spring for this (yes there is a limitation as to what components can be injected, but its a start). I still see awesome value in AOP, JDBC/DAO, and all the other enterprise services "made easy" (disregarding MVC,rich,WS for now), but I'm starting to wonder about the need for spring in the business component game. I get the feeling that up until now everyone was playing catch up to spring, now I think that spring need to catch up to the rest of the pack and come up with a neat, simple set of tools for assisting JEE, rather than competing directly. Anyway, thats enough of a rant for now, time for some sleep. Looking forward to other responses. Maybe this deserves a different forum.
  16. page problem[ Go to top ]

    ...and could a TSS boffin please delete that long bit of embedded HTML in the comment by Kees, its pulling the page in firefox wide apart. thx ;)
  17. Re: page problem[ Go to top ]

    ...and could a TSS boffin please delete that long bit of embedded HTML in the comment by Kees, its pulling the page in firefox wide apart. thx ;)
    I wholeheartedly agree. To say that code block ruins this post is a sad understatement... it really hampers communication when you have to scroll horizontally to read something.
  18. Re: page problem[ Go to top ]

    it really hampers communication when you have to scroll horizontally to read something.
    If you're using firefox, you should get the nuke anything plugin: https://addons.mozilla.org/en-US/firefox/addon/951 This lets you rip out anything on any web page via right click + "remove object", extremely useful in many circumstances including this one.
  19. Hi, In my option spring is a great technical basis to develop information systems. Spring gives me the flexibility to design my own “reference architecture” with technical services like transactions and persistence and good separation of concerns. However, adding a new field to an existing browser form (or adding complete new functions) still requires many steps to modify the whole layered application. This is because a parameter has to be added to all methods from the dialog component down to the persistence component. I would love to have a customizable code generation function (e.g. based on Java annotations). That is, you could use Spring like Rails, but for my own customized reference architecture. E.g. you just write a new business object (or browser form) and Spring would automatically (or with the help of a wizard) generate all objects and methods in all defined components of my reference architecture (from browser forms in the dialog layer to CRUD methods in the persistence layer). This approach could lead to a new abstract layer on top of the existing Spring framework, making spring much more effective and timesaving... Marcus