Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-5611

Preserve custom annotations present on @Bean methods for interrogation during bean post processing

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.0 M2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      With Spring using more and more annotations, it would be good if the bean definitions allow registering custom annotations for use with Bean/Factory post processors.

      Specifically, in JavaConfig one can annotate a method in a configuration class with @Bean annotation to create a bean from the result of the method. However, it is not possible to add custom annotations on the method so as to process them with a bean post processor.

      The use case is for integrating with spring-dm. Specifically, I would like to annotate a "regular" @Bean method with @OsgiService annotation so the bean is published as a service.

      NOTE: another approach is to allow me to replace @Bean with @OsgiServiceBean which would do both. The current JavaConfig code is very tightly bound to the internal annotations and it is had to add custom ones (specifically, i can't create a custom annotation and reuse BeanRegistrar since it uses @Bean directly)

        Attachments

          Activity

            People

            Assignee:
            cbeams Chris Beams
            Reporter:
            ittayd Ittay Dror
            Last updater:
            Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 40 weeks, 2 days ago