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 trialHannah Lee
80,187 PointsAdd a service interface and implementing class in their respective files. Include a findById method that accepts a Long
I'm stuck in this session...please help me...
package com.teamtreehouse.contactmgr.service;
import com.teamtreehouse.contactmgr.model.Contact;
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
private CategoryService category Service{
@Override
public interface Category{
Category findByID(Long id);
return null;
}
}
1 Answer
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsThe โPreviewโ button will let you see the compiler errors. Hereโs the first error I get when I ran your code:
com.github.javaparser.ParseException: Encountered " "CategoryService "" at line 10, column 9.
Was expecting one of:
"class" ...
"enum" ...
"interface" ...
This is what we have on line 10 of ContactServiceImpl.java
private CategoryService category Service {
So itโs seeing CategoryService
and was expecting some other keyword like class
, enum
, interface
. In this case, I think it should be class. What we want to do here is define an interface in ContactService.java and a class that implements that interface in ContactServiceImpl.java
The best video for you to reference for this is a couple steps back here.
Let me know if you have more questions.