Announcement Announcement Module
Collapse
No announcement yet.
Importing a single bean definition using the import tag Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Importing a single bean definition using the import tag

    As a comment to the original post related to the import tag, I would add that I find the import tag quite useful especially for the fact that it allows the reuse of bean definitions from both appContext.xml and xxx-servlet.xml

    What I would like to have is the ability to import a single bean definition from an appContext. Something like:

    Code:
    <import resource="appContext-common.xml" beanId="myBean" />
    This would have the following advantages:
    1. You import only the bean definitions that you actually need, thus saving some initialization overhead.
    2. Avoid potential circular dependencies caused by unused beans in the imported file.

    ...and the potential disadvantage of allowing the configuration to be less organized.

    Any comments?

    Thanks,
    Adrian

  • #2
    You import only the bean definitions that you actually need
    Can't you just separate out the beans you need and import them into the files where they're needed - so that you don't import uneeded beans?

    How would you import multiple beans. Something like...
    Code:
    <import resource="appContext-common.xml">
        <bean id="myBean1"/>
        <bean id="myBean2"/>
    </import>

    Comment

    Working...
    X