Consider defining a bean of type 'com.okta.developer.demo.CarRepository' in your configuration

I ran the okta-spring-boot-2-angular-5 demo in eclipse on java 1.8 ,when start the application occur error below:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled.
2018-03-02 01:29:58.287 ERROR 10012 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Parameter 0 of constructor in com.okta.developer.demo.CoolCarController required a bean of type ‘com.okta.developer.demo.CarRepository’ that could not be found.

Action:

Consider defining a bean of type ‘com.okta.developer.demo.CarRepository’ in your configuration.

how to solve this ?

Did you create a CarRepository.java like the tutorial asks you to do?

Create a CarRepository class to perform CRUD (create, read, update, and delete) on the Car entity.

package com.okta.developer.demo;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

@RepositoryRestResource
interface CarRepository extends JpaRepository<Car, Long> {
}

yes i have the class in project

package com.okta.developer.demo;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.CrossOrigin;

@RepositoryRestResource
@CrossOrigin(origins = “http://localhost:4200”)
interface CarRepository extends JpaRepository<Car, Long> {
}

but it doesn’t work

I would suggest cloning the example project from GitHub and see if you can get it working. You can also use a tool like SmartSyncronize to diff between the completed project and yours.