CourseService
package br.com.jaquesprojetos.forum.service
import br.com.jaquesprojetos.forum.model.Course
import br.com.jaquesprojetos.forum.repository.CourseRepository
import org.springframework.stereotype.Service
@Service
class CourseService(
var courses: List<Course> = listOf(),
private val repository: CourseRepository
) {
fun list(): List<Course> {
return courses
}
fun getCourse(id: Long): Course {
return courses.stream().filter { it.id == id }.findFirst().get()
}
fun createCourse(course: Course): Unit {
courses.plus(course)
}
}
CourseRepository
@Repository
interface CourseRepository : JpaRepository<Course, Long> {
}
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of constructor in br.com.jaquesprojetos.forum.service.CourseService required a bean of type 'br.com.jaquesprojetos.forum.repository.CourseRepository' that could not be found.
Action:
Consider defining a bean of type 'br.com.jaquesprojetos.forum.repository.CourseRepository' in your configuration.
Apenas pelo fato de chamar o repository já recebo a mensagem de erro.