This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

So my custom method should be acessible in addition to the standard CRUD operations containing my hand written code.
But when I start my application, spring tries to build a query from my custom methods' name - and fails of course:

Code:

Caused by: java.lang.IllegalArgumentException: No property find found for type class my.domain.FooObject
at org.springframework.data.repository.query.parser.Property.<init>(Property.java:66)
at org.springframework.data.repository.query.parser.Property.<init>(Property.java:100)
at org.springframework.data.repository.query.parser.Property.create(Property.java:300)
at org.springframework.data.repository.query.parser.Property.create(Property.java:314)
at org.springframework.data.repository.query.parser.Property.create(Property.java:280)
at org.springframework.data.repository.query.parser.Property.from(Property.java:239)
at org.springframework.data.repository.query.parser.Property.from(Property.java:227)
at org.springframework.data.repository.query.parser.Part.<init>(Part.java:48)
at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:242)
at org.springframework.data.repository.query.parser.PartTree.buildTree(PartTree.java:101)
at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:77)
at org.springframework.data.document.mongodb.repository.PartTreeMongoQuery.<init>(PartTreeMongoQuery.java:42)
at org.springframework.data.document.mongodb.repository.MongoRepositoryFactoryBean$MongoRepositoryFactory$MongoQueryLookupStrategy.resolveQuery(MongoRepositoryFactoryBean.java:203)
at org.springframework.data.repository.support.RepositoryFactorySupport$QueryExecuterMethodInterceptor.<init>(RepositoryFactorySupport.java:290)

So it seems that I have to explicitly name all DAOs that I'm using when specifying a custom impl. Only specifying the custom repository doesn't work. Then an exception 'No bean 'userDao' exists' is thrown.
Without using a custom repository impl just:

Code:

<repositories base-package="my.dao.package">

seems sufficient though.

Comment

I think you stumble over the fact that we lookup the implementation interface and class in the very same package of the original repository interface. If you place all into one you should be fine. A second approach should be naming the implementaion bean accountDaoImpl as we check for an existing bean matching the "repository name + postfix" pattern before registering a bean definition for a potentially found class. This should enable you to get rid of the manual repository configuration.

The manual configuration was initially designed for users with the need for very fine grained control and currently pretty much disables automatic lookups entirely. We were thinking about changing that to still do automatic configuration but taking explicitly defined repository beans into account 8so pretty much the way you initially expected it to work). If you think that's the more convenient approach feel free to raise a JIRA ticket.

Comment

I think you stumble over the fact that we lookup the implementation interface and class in the very same package of the original repository interface. If you place all into one you should be fine. A second approach should be naming the implementaion bean accountDaoImpl as we check for an existing bean matching the "repository name + postfix" pattern before registering a bean definition for a potentially found class. This should enable you to get rid of the manual repository configuration.

I can confirm, both of your suggested ways work. The problem was, I named my file DAO instead of Dao hence the problem I guess. Heard that those algorithms begin to struggle with these kind of namings. I simply changed it to Dao and now
it works like you've described it.

Thanks!

Comment

I think you stumble over the fact that we lookup the implementation interface and class in the very same package of the original repository interface. If you place all into one you should be fine. A second approach should be naming the implementaion bean accountDaoImpl as we check for an existing bean matching the "repository name + postfix" pattern before registering a bean definition for a potentially found class. This should enable you to get rid of the manual repository configuration.

I believe I have followed the first approach to the letter and read the reference document (see link bellow) over and over, but I still get the same error as vguna.

Comment

Try removing the doStuff() method declaration from the RepresentativeRepository interface (although that shouldn't cause the error). What exceptions are you guys seeing? You might wanna have a look at the examples repo which has a sceneario like this implemented at [0].

So it seems that I have to explicitly name all DAOs that I'm using when specifying a custom impl. Only specifying the custom repository doesn't work. Then an exception 'No bean 'userDao' exists' is thrown.
Without using a custom repository impl just: