Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Spring with Hibernate Data-Driven Application Design Add a service for Contact objects

Bummer! ContactDao's findById method was not called

Can someone please help, here's my objective:

Add an autowired ContactDao to the ContactServiceImpl class, and use the ContactDao class's findById(Long) method to implement the findById method in the ContactServiceImpl class.

com/teamtreehouse/contactmgr/service/ContactService.java
package com.teamtreehouse.contactmgr.service;

import com.teamtreehouse.contactmgr.model.Contact;

public interface ContactService {
    List<Contact> findAll();
    Contact findById(Long id);
}
com/teamtreehouse/contactmgr/service/ContactServiceImpl.java
package com.teamtreehouse.contactmgr.service;

import com.teamtreehouse.contactmgr.dao.ContactDao;
import com.teamtreehouse.contactmgr.model.Contact;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ContactServiceImpl implements ContactService {
    @Autowired
    private ContactDao cotactDao;
    @Override
    public List<Contact> findAll() {
        return ContactDao.findAll();
    }
    @Override
    public Contact findById(Long id) {
      return ContactDao.findById(id);
    }
}
James Peck
James Peck
14,289 Points

You have a spelling error:

    private ContactDao cotactDao;

should be

 private ContactDao contactDao;

also you capitalized contactDao in the return statements.