Announcement Announcement Module
Collapse
No announcement yet.
Specifying context dependencies... in the context. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Specifying context dependencies... in the context.

    I use contexts that reference beans specified in other contexts. For example, context A.xml uses a bean in B.xml.

    If I were using a ClassPathXmlApplicationContext to get the context, I'd have to load them with:
    Code:
    ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"A.xml", "B.xml"});
    But it would be a lot cleaner to simply load them with:
    Code:
    ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"A.xml"});
    and have 'something' in A.xml that tells it to load B.xml from the classpath.

    I know that 'something' must exist. What is it, and what is its syntax?

  • #2
    <import resource="B.xml" />

    Comment


    • #3
      So simple and obvious... yet I've been looking for it for months.

      THANK YOU!!!

      Comment

      Working...
      X