Results 1 to 2 of 2

Thread: Get a DAO Bean from a POJO, which isn't a Bean

  1. #1
    Join Date
    Sep 2004
    Location
    Winterthur, Switzerland
    Posts
    58

    Default Get a DAO Bean from a POJO, which isn't a Bean

    Are there any recommended way's how a POJO,
    which isn't a Bean and thus not created via Spring,
    can get a Bean Instance, which is created and configured by Spring?

    For example a Object which lazily loads data from the database
    and need's it's DAO.

    A static method of the desired Bean?
    Pass the context along with the constructor?

    Best thanx for any feedback.
    Christoph

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    You have several approaches:
    1. you can use an utility which retrieves the app-context (from the web context inside the web apps).
    2. once the POJO is retrieved inside your webapp you can wire the DAO programatically on it.

    It really depends on your scenario.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  5. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM

Posting Permissions

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