Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeremiah Shore
31,168 PointsAdd a service for Contact objects, task 2 not passing
As far as I can tell, I have everything I need to include an AutoWired ContactDao
object so that I can call and return its findById(Long id)
method from within my service's method of the same name. What am I missing?
I keep getting "Could not find an autowired ContactDao" as my error message.
package com.teamtreehouse.contactmgr.service;
import com.teamtreehouse.contactmgr.model.Contact;
public interface ContactService {
Contact findById(Long id);
}
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 contactDao;
@Override
public Contact findById(Long id) {
return contactDao.findById(id);
}
}
1 Answer
Jeremiah Shore
31,168 PointsIt was the capitalized W in my @AutoWired
annotation... it should be @Autowired
LOL
Anyone else think this is a poor naming choice? I know this has hit me in the past, but luckily IntelliJ catches it for me, unlike these code challenges :P