Announcement Announcement Module
Collapse
No announcement yet.
Import resource should work like Class.getResource() Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Import resource should work like Class.getResource()

    I have a resource files:
    /com/domain/app/applicationContext.xml
    /com/domain/app/applicationContext-dao.xml
    /com/domain/app/sub/applicationContext-sub.xml

    Importing a resource should work like Class.getResource() IMHO.

    In the applicatoinContext.xml I do
    <import resource="applicationContext-dao.xml"/>
    and this works: it doesn't start with /, so the package is prependend, nice

    However
    <import resource="/com/domain/app/sub/applicationContext-sub.xml"/>
    doesn't work: it does start with /, but still the package is prependend, so he looks for /com/domain/app/com/domain/app/sub/applicationContext-sub.xml

    I can do my currentl functionality with relative paths however.

  • #2
    you can only import files relative to the root context path. Slashes '/' are eliminated by Spring. See also the Spring documentation '3.18. Importing Bean Definitions from One File Into Another':
    All location paths are considered relative to the definition file doing the importing

    Rene

    Comment

    Working...
    X