Я создаю REST API и, похоже, не могу избавиться от org.springframework.beans.factory.UnsatisfiedDependencyException, я не могу определить проблему в этом. Я буду признателен за глубокое понимание этого.
ps: используя mon go DB для этого
сначала отключите полную ошибку
2020-05-04 01:16:31.468 WARN 14412
--- [ main] ConfigServletWebServerApplicationContext :
Exception encountered during context initialization -
cancelling refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'productController':
Unsatisfied dependency expressed through field 'productService';
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'productServiceImpl':
Unsatisfied dependency expressed through field 'productRepo';
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'productRepo':
Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException:
No property id found for type Product!
public class Product {
@Id
private int ProductId;
// and other variables plus setters and getters
@Repository
public interface ProductRepo extends MongoRepository<Product, String> {
// methods
}
public interface ProductService {
// methods
}
@Service
public class ProductServiceImpl implements ProductService {
@Autowired
private ProductRepo productRepo;
// implementations
}