Announcement Announcement Module
No announcement yet.
Get a DAO Bean from a POJO, which isn't a Bean Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    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.