Discussions

News: Spring-Annotation v1.0 released

  1. Spring-Annotation v1.0 released (17 messages)

    Spring-Annotation is a library that enables the development of applications using Spring Framework, but with much less XML than the "vanilla" Spring. For example, to register a bean in the BeanFactory you does not need to edit any XML, just annotate your class with the @Bean annotation. The library has 5 distinct modules:
    • base - the one that enables the use of annotations to configure the application Context
    • web - facilities to create web applications
    • jsf - many facilities to work with JSF applications, and some annotations ported from Seam like @DataModel
    • security - blank for now, but will have support for the standard Java EE security annotations in the next version
    • hibernate - just one class for now, an AutomaticAnnotationSessionFactory, a SessionFactory that searches the classpath for classes with the @Entity annotation and registers each in the SessionFactory automatically
    The main purpose of this library is not to erase all the XML of the application, but keep only what is "configuration" in the XML and keep your business code in Java. There are just 3 examples in the site for now, but there are some almost ready and the documentation needs a lot of work, but we are working on it. :D Message was edited by: joeo@enigmastation.com
  2. Re: Spring-Annotation v1.0 released[ Go to top ]

    No harm in having options, but if you are going to go this route, I don't understand why you would use Spring for application configuration at all. And I would hate for someone who is brand new to Spring to be exposed to this. @Bean, @Property, and @ConstructorArg transform Spring from a dependency injection framework into a service locator framework. I believe the point of Spring was to offer an alternative to Service Location patterns. Once you use these annotations, you can have at most one implementation (or configuration) of a given bean across all deployments of your application. I think the user-defined schemas in Spring 2.0 offer much better opportunities for simplifying XML configuration than these baby-with-the-bathwater approaches.
  3. Re: Spring-Annotation v1.0 released[ Go to top ]

    Well you could always have an external configuration file read in by the Spring Annotation framework to..... Just kidding :-)
  4. Well you could always have an external configuration file read in by the Spring Annotation framework to.....

    Just kidding :-)
    Ha ha ha!! Good one...
  5. Well you could always have an external configuration file read in by the Spring Annotation framework to.....

    Just kidding :-)
    Well, I use both approaches while programming. Spring-Annotation is not a replacement for the spring-framework, it is an addon, so you does not have to give up on your external configuration XML ... for example, I will probably never change the implementation of my business object, so I annotate it with @Bean, but there is a big chance that the DataSource will not be the same in my development environment and in the deployment environment, so I put in in the applicationContext.xml file ... (just an example)
  6. Re: Spring-Annotation v1.0 released[ Go to top ]

    I think the point of spring is to let you choose from a big toolbox. Choice is a great thing, and not everybody needs configuration to be purely external. Besides, if you nave nothing else that configures your dependencies except for Spring, then it's somewhat academic at that moment that you can be independent from Spring and wire things up yourself. Of course, if you're writing a web app and you like annotations for your dependency configuration, you may as well use Seam (which can use external configuration too, but annotations is where it really shines).
  7. Re: Spring-Annotation v1.0 released[ Go to top ]

    Besides, if you nave nothing else that configures your dependencies except for Spring, then it's somewhat academic at that moment that you can be independent from Spring and wire things up yourself. The point is not to be independent from Spring, it is to be able to define multiple deployments of your application without having to change any of your code for each deployment. It's not academic, I use it in all of my projects.
  8. not entirely truth[ Go to top ]

    yes, it is true, using this annotations (@Property and @ConstructorArg) you is using spring as a service locator ... I don`t agree about @Bean which is exactly the same as using the XML file with autowire=byName (which is the default for the @Bean but you can change if you want) but in my opinion, and it was the main reason to start coding this library, I think it is another option to make easy to configure the parts of your application that does not need the external configuration. user defined schemas offer better oportunities than the vanilla XML configuration, but I really think that with the annotations it is very easy to do the basic configurations :D
  9. Great work[ Go to top ]

    Ar! Tis another great work from those land-lubbing Spring guys!
  10. Re: Great work[ Go to top ]

    Ar! Tis another great work from those land-lubbing Spring guys!
    IMPORTANT NOTE: spring-annotations has got absolutely nothing to do with "the Spring guys". The name this project picked is quite unfortunate (and improper) as it would seem to imply that the Spring project produced this, or endorses this, when it in fact has no connection to the Spring project or any of the "official" subprojects (Spring Web Flow, Spring Security (nee Acegi), Spring Web Services, Spring-LDAP, Spring Rich Client, etc.). -- Colin Sampaleanu Principal, Interface21 Spring Training, Consulting and Support - "From the Source" http://www.interface21.com
  11. exactly[ Go to top ]

    sorry for the name, but for now this library has only two developers I`m the main developer and there is another friend helping with examples and testing ... I hope that now with the 1.0 release we got some more help, at least for the testing :D
  12. at the truth they have nothing to do with this library, I`m trying to talk with them to list it as a "Associated Project" :)
  13. Well for me this is a great news. I'm gonna try JSF and Hibernate module. I've been doing some research on Seam vs Spring and the JSF annotations was the thing a missed the most in Spring. External Spring context configuration was why I've choosen Spring over Seam. Switching context configurations is perfect for deploying in testing environment and this is hard to achieve with annotated code. Though I'm gonna stay with XML context config. Anyway - well done!
  14. Thanks ... I`ll post tomorrow an example for using just the JSF and Hibernate modules, and the configuration only in the XML (like vanilla spring framework) Any problems just tell me :D
  15. Congratulations for this great initiative ! I have been waiting for annotation based spring configuration for a while. I know Spring guys are against this single configuration approach and indeed, you loose the ability to have multiple configurations for each bean, but let's be pragmatic, IoC external configuration is not always required, often you don't care, you just need to configure your bean one way while still benefiting from injection, and in that situation, external XML configuration is a burden whereas annotation based configuration is appropriate. Anyway, Spring already allows single configuration with constructor injection. Since, constructor injection relies only on the type of the constructor argument, there can only be one instance implementing that type in the context. So why not allow annotation based configuration ? ;) What's more, by using annotation based configuration together with autowiring and constructor injection, one could achieve IoC with near zero configuration. But ... Spring-Annotations seems to have a major design limitation. It would have been wiser to use meta annotations to avoid making the user code having to depend directly on Spring-Annotations. Of course, default annotations should be provided for convenience but that way, one can mark one's annotations with spring behavior and isolate the Spring-Annotations coupling. Finally, some choices are weird here. For example, why is initMethod an attribute of the @Bean annotation and not a dedicated method targetted @Init annotation ? Same remark applies for all attributes which take a method name as a value: destroyMethod, ... Regards, Cédric
  16. to avoid the dependency on the Spring-Annotation code, I was starting to enable the use of the standard Java EE annotations for the next version, but the use of meta annotations is a good idea too, I`ll think about that ... about the initMethod and destroyMethod parameters, I agree with you, and there will be an @Init and an @Destoy annotation (or some thing like that) the chioce to start by the parameters was because, in this first release, the @Bean is almost a "mirror" of the tag ... Regards, Urubatan
  17. to avoid the dependency on the Spring-Annotation code, I was starting to enable the use of the standard Java EE annotations for the next version, but the use of meta annotations is a good idea too, I`ll think about that ...
    The Pitchfork project implements JSR-250 (Common Annotations for the Java Platform) on top of Spring. This is used in the next version of WebLogic to help implement Java EE 5.0 injection and interception, and is useable standalone also. Rgds Rod Interface21 - Spring from the Source: Training, Consulting, Support
  18. I have looked at pitchfork, but it does not enables spring to registers beans only adding an @Stateless annotation. I still have to create a XML file to configure them (am I wrong?)