Robert Borya
Robert Borya

Reputation: 1

"Error creating bean with name ..." it happens in an instance of MongoRepository, I'm using Java11 and springboot

I can't find by my life what to do to resolve this xD

The error goes as fowllowing:


org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'itemHandler': Unsatisfied dependency expressed through field 'repo'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemRepository' defined in com.example.demo.service.itemRepository defined in @EnableMongoRepositories declared on MongoRepositoriesRegistrar.EnableMongoRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property findbyidItem found for type ItemObject!

If you wanna look at the code, the app is pretty small : https://bitbucket.org/ZeroD0Z/zerod0z-api/src/master/demo/src/main/java/com/example/demo/

Upvotes: 0

Views: 1777

Answers (1)

Boris Kukec
Boris Kukec

Reputation: 721

You should rename your repository method, the right name should be with the capitalized property name,(and keyword By also). So the right name would be (notice IdItem):

ItemObject findByIdItem (String idItem);

Otherwise, JPA can not resolve the property name.

Upvotes: 3

Related Questions