Announcement Announcement Module
Collapse
No announcement yet.
replacing custom springlike framework Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • replacing custom springlike framework

    I wrote my own kind of springish framework, and there's one thing it does that I haven't found a way to do in spring. Basically I want to reload a single bean on demand.

    My current frameworks works like:
    Loader servlet runs first, and creates and loads Engines into the servlet context.

    Servlets come along and register the Engines into a Context Bus.
    These Engines are executed in order, passing a custom context object between them.
    Servlet exits.

    Now at any time, we can reload on demand a particular Engine, such as, say,
    the TemplateEngine, which contains templates. We can edit templates, then in a script create a new TemplateSystem which the TemplateEngine loads when it comes alive. Then on the next hit, the Servlets immediately see the new templates, and the old TemplateEngine passes out of existence.

    Is there a way to tell Spring "hey, go make me a new TemplateEngine!"?

    aash

  • #2
    Well you can reload an applicationcontext, however that is a total reload. But reloading parts of the context I don't think it is able to do by default.

    One solution would be to create a TargetSource which checks to see if it should reload/create a new Engine, create the Engine or return the old instance. Shouldn't be that hard to implement.

    Comment


    • #3
      Refreshable

      Thanks for the reply! Yes, refreshing all the beans would definitely not be an option.. In looking at TargetSource i found: http://www.springframework.org/docs/...freshable.html
      which looks like it might be interesting... Has anyone worked with it?

      aash

      Comment


      • #4
        this isn't what Refreshable does

        Oh well, the search continues!

        aash

        Comment


        • #5
          Just out of interest, when you say reload an engine what does that really mean? Is this something Spring should actually do, or is this simply the overlap between the two approaches? At this point your code kicks in a does it's magic.

          Comment


          • #6
            Engines in my system are a type of module or plugin. I create servlets by configuring a bus of engines. The ones that periodically need refreshing are typically ones that encapsulate some data, such as html templates, or whatever without having to stop and start the server. At the moment i use a home grown loader to load them into the servlet context. If I were going to move to Spring, I'd have to have a way to duplicate this functionality.

            Comment


            • #7
              It very much sounds like you want several modules each of which can be refreshed independently. I'm thinking this might sound like OSGi ground.

              Comment

              Working...
              X