facebook

Using DAO in my own class

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #309289 Reply

    wssDude
    Member

    I have created a project in MyEclipse for Spring, added Spring capabilities, added a CRUD and Web Service, they work.

    Now I created my own class and want to use the same DAO that my service does.
    If I declare a variable for the DAO in my class, like it is declared in the service, it is just null.


    @Resource
    (name=”LogDAO”)
    private LogDAO logDAO;

    How do I declare and/or wireup, the DAO in my own class, so I can use it like I do in the service?

    Thanks

    #309336 Reply

    neyde
    Member

    @wssDude wrote:

    How do I declare and/or wireup, the DAO in my own class, so I can use it like I do in the service?
    Thanks

    Is your class managed by Spring? Has it been declared in Spring context file or annotated as either a Controller/Service/Component?

    #309408 Reply

    wssDude
    Member

    Once I added @Component, MyEclipse made a bunch of modifications and now the DAO is working. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Using DAO in my own class

You must be logged in to post in the forum log in