Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6799733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:53:01+00:00 2026-05-26T18:53:01+00:00

Based on the Spring Data Document documentation , I have provided a custom implementation

  • 0

Based on the Spring Data Document documentation, I have provided a custom implementation of a repository method. The custom method’s name refers to a property which doesn’t exist in the domain object:

@Document
public class User {
    String username;
}

public interface UserRepositoryCustom {
    public User findByNonExistentProperty(String arg);
}

public class UserRepositoryCustomImpl implements UserRepositoryCustom {
    @Override
    public User findByNonExistentProperty(String arg) {
        return /*perform query*/;
    }
}

public interface UserRepository
        extends CrudRepository<?, ?>, UserRepositoryCustom {

    public User findByUsername(String username);
}

However, perhaps because of the method name I’ve chosen (findByNonExistentPropertyName), Spring Data attempts to parse the method name, and create a query from it. When it can’t find the nonExistentProperty in User, an exception is thrown.

Possible resolutions:

  1. Have I made a mistake in how I provide the implementation of the custom method?
  2. Is there a way to instruct Spring to not attempt to generate a query based on this method’s name?
  3. Do I just have to avoid using any of the prefixes that Spring Data recognizes?
  4. None of the above.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:53:01+00:00Added an answer on May 26, 2026 at 6:53 pm

    Your implementation class has to be named UserRepositoryImpl (if you stick to the default configuration) as we try to look it up based on the Spring Data repository interface’s name being found. The reason we start with that one is that we cannot reliably know which of the interfaces you extend is the one with the custom implementation. Given a scenario like this

    public interface UserRepository extends CrudRepository<User, BigInteger>,
      QueryDslPredicateExecutor<User>, UserRepositoryCustom { … }
    

    we would have to somehow hard code the interfaces not to check for custom implementation classes to prevent accidental pick-ups.

    So what we generally suggest is coming up with a naming convention of let’s say the Custom suffix for the interface containing the methods to be implemented manually. You can then set up the repository infrastructure to pick up implementation classes using CustomImpl as suffix by using the repository-impl-postfix attribute of the repositories element:

    <mongo:repositories base-package="com.acme" 
                        repository-impl-postfix="CustomImpl" />
    

    There’s more information on that in the reference documentation but it seems you have at least briefly checked that. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a document based application running with core data. The object model has
I've a document-based application powered by Core Data with an in-memory store. I have
I have a string in c# containing some data i need to extract based
I have a spring-based Web Service. I now want to build a sort of
I wrote my own custom namespace for a Spring based project I'm working on.
We have a legacy web application (not Spring based) and are looking for best
I'm trying to configure a class with Annotation based configuration in Spring 3, which
We have a Spring + Ibatis based J2EE app. I planned to wrap around
I have a following method which takes a XDocument, iterates through the nodes and
I have a problem in creating an AJAX-based form submission which if its response

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.