Announcement Announcement Module
Collapse
No announcement yet.
Singleton locator in a web application Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Singleton locator in a web application

    Hi,
    I'm trying to port an old client/server application written using Hibernate alone to a three tier architecture using Spring remoting.
    The application uses a domain model that is far from anemic, and the domain objects often have direct access to DAOs.

    Now, I'd like to make it work with Spring 1.2.x without getting crazy.
    On the client side the domain objects should speak to remoting proxies, on the server side to the actual DAOS (well, their Spring transactional wrappers).

    I'd like to implement this using a singleton pattern implemented with a single static class (I know, I know, but this is really the easiest way and I don't have much time).
    On the client side that singleton returns references to the spring remoted services, on the server side it should get the application context and return the transactional wrappers.
    This way the domain objects should be able to work without knowing where they are.

    The idea, on server side, is to extend the context loading listener and have it set the built application context in the singleton.
    Now, the question: does someone see problems with the above solution? Will it work, what kind of quirks I'm going to face for not following a pure IOC approach?

  • #2
    You can use the SingletonBeanFactoryLocator. It will offer you a singleton context which, in turn, will allow you to use Spring IoC.

    Comment

    Working...
    X