Announcement Announcement Module
Collapse
No announcement yet.
Quick Question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quick Question

    i have a very large ApplicationContext.xml, for our entire app.
    i want to break it up like

    applicationContext-dao.xml , has my hibernat DAO stuff with JNDI


    which is imported into the main applicationContext.xml


    how would the syntax of the applicationContext.xml look if i want to use this at a pace in the xml file..

  • #2
    3.18. Importing Bean Definitions from One File Into Another
    and check 3.19.

    Comment


    • #3
      You should also consider to break your xml file in vertical slices.

      So you could have:
      dataSource.xml -> Database connection, Hibernate, etc
      globalConfig.xml -> messages, PropertyPlaceholders, etc
      -servlet.xml -> DispatcherServlet

      and for every slice a *Context.xml file with all of the beans that are relevant to the slice. For example:
      userContext.xml
      orderContext.xml
      newsContext.xml
      ...
      Each of these xml files should contain the daos, service layer, web stuff, etc. I think itīs a good idea to break an application into these "application components".

      Comment


      • #4
        thx for response

        the break up to

        dataSource.xml -> Database connection, Hibernate, etc
        globalConfig.xml -> messages, PropertyPlaceholders, etc

        pattern is good..

        however breaking up each DAO mapping into a seperate file might not be a good pattern, even in J2ee DD they have one file for all the DAO config info.

        thanks all for the answer & info.

        Comment


        • #5
          even in J2ee DD they have one file for all the DAO config info
          J2EE is one thing, OO and the application layout another. IMHO, J2EE and other technologies shouldnīt dictate your DESIGN. Even in an middle sized app with 50 DAOs in one xml file, this file quickly becomes unmanageable.

          For me, it makes a lot of sense to group the DAOs that a part of an "application component" (perhaps module is a better name) besides the service layer, etc.

          The component idea can be applied at several levels. Fine grained components such as DAOs, validators, etc and coarse grained components such as a user management, order management, etc.
          Each coarse grained component has itīs own service layer AND configuration.

          Best regards,

          Roman

          Comment

          Working...
          X