Results 1 to 7 of 7

Thread: replacing custom springlike framework

  1. #1
    Join Date
    Mar 2007
    Posts
    5

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Mar 2007
    Posts
    5

    Default 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

  4. #4
    Join Date
    Mar 2007
    Posts
    5

    Default this isn't what Refreshable does

    Oh well, the search continues!

    aash

  5. #5
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    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.

  6. #6
    Join Date
    Mar 2007
    Posts
    5

    Default

    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.

  7. #7
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •