Announcement Announcement Module

JavaConfig forum decommissioned in favor of Core Container

As described at

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at
See more
See less
Spring 3.0 and Spring JavaConfig compatability Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.0 and Spring JavaConfig compatability


    I am really unsure on the compatability status here?
    From simply downloading the 1.0.0M4 JavaConfig release and Spring 3.0.1 release I have encountered numerous errors. Current one is below.

    Given these problems and simple things like the 1.0.0M5 link goes to a blank page I am not really happy to proceed with adoption now of JavaConfig and will stick with xml based which is a shame.

    Can you let me know when there is likely to be a final release of Spring JavaConfig which works out of the box with Spring 3.0.x releases, without ambiguity to where annotations live and without problems in getting the very simplest of examples working?



    Exception in thread "main" java.lang.annotation.AnnotationFormatError: Invalid default: public abstract org.springframework.beans.factory.annotation.Autow ire ration.defaultAutowire()
    at java.lang.reflect.Method.getDefaultValue(Method.ja va:726)
    at sun.reflect.annotation.AnnotationType.<init>(Annot
    at sun.reflect.annotation.AnnotationType.getInstance(
    at sun.reflect.annotation.AnnotationParser.parseAnnot ation(
    at sun.reflect.annotation.AnnotationParser.parseAnnot ations2(
    at sun.reflect.annotation.AnnotationParser.parseAnnot ations(
    at java.lang.Class.initAnnotationsIfNecessary(Class.j ava:3070)
    at java.lang.Class.getAnnotation(
    at tationExtractionUtils.extractClassAnnotation(Annot
    at figurationClass.<clinit>( 5)
    at sm.AsmConfigurationParser.parse(AsmConfigurationPa
    at upport.AsmJavaConfigBeanDefinitionReader.loadBeanD efinitions( 70)

  • #2
    The main part of javaconfig is part of the spring framework, so for the 80% cases you should be fine with the implementation provided default with spring.


    • #3

      But it has only been in scratching around replacing JavaConfigApplicationContext with the Annotated version, annotations etc, that I have managed to get even the simplest application working.

      I really think you need to document this better.

      a) What is included in the main Spring distribution?
      b) What is extra in JavaConfig?
      c) Where the crossover and compatability/incompatabilities lie?

      80% is a bit arbritary, what exactly would I be missing in ignoring JavaConfig entirely ?

      Having used Spring for a long, long time I am quite shocked how this hasn't been made obvious as in general the reference documentation for the main distributions is excellent.




      • #4
        Hi Liam,

        The JavaConfig project will be formally shut down in the near future. Please keep in mind that JavaConfig was never brought to a GA release, and this was actually intentional. Porting the project into Spring Core represents the ability to have many many more users evaluate the approach and provide feedback. We have moved what is proven into the core, and some of the other more experimental features may make it in over time. This includes annotation support that mirrors the Spring XML namespaces, for example @ComponentScan.

        From this point forward, assuming you're using Spring 3.0 GA or better, JavaConfig should be considered deprecated and generally incompatible with core.

        If you have particular feature requests for @Configuration support within Spring 3.0, please do not hesitate to add issues in JIRA. Thanks for your feedback!


        • #5
          Thanks Chris,

          I am pleased that this is the case as moving JavaConfig into the core where the other configuration API's live makes complete sense. The only thing I would suggest is please add some very clear notifcation on the JavaConfig home page just to prevent developers trying to combine in error.

          One other thing I was curious about was JUnit test support for. Is there are equivalent to the @ContextConfiguration annotation that takes Classes for the context resource location ?




          • #6
            With regard to first-class support for @Configuration classes within the TestContext framework (including @ContextConfiguration), please put a watch on, which is scheduled for the upcoming Spring 3.1 release.