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

  • SEARCH
  • Home
  • 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 8263397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:05:13+00:00 2026-06-08T04:05:13+00:00

I use Spring data jpa and I am trying to add custom behaviour to

  • 0

I use Spring data jpa and I am trying to add custom behaviour to all repositories as described here:
http://static.springsource.org/spring-data/data-jpa/docs/current/reference/html/#repositories.custom-behaviour-for-all-repositories

I encountered several issues:

-First, there is no such method as getDomainClass in the RepositoryMetadata class as described in the Spring documentation (see below):

protected Object getTargetRepository(RepositoryMetadata metadata) {
      return new MyRepositoryImpl<T, I>((Class<T>) metadata.getDomainClass(), entityManager);
}

I used the following method instead: getDomainType() Is this right?

-Second my application throws exceptions when tomcat starts. Here is the full stack trace:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalRepositoryImpl' defined in file [E:\users\jumartin\dev_sts\.metadata\.plugins\org.eclipse.wst.server.core\
tmp0\wtpwebapps\SuiviTRC\WEB-INF\classes\trc\suivi\repository\GlobalRepositoryImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could
 not instantiate bean class [trc.suivi.repository.GlobalRepositoryImpl]: No default constructor found; nested exception is java.lang.NoSuchMethodException: trc.suivi.repository.GlobalRepositoryImpl.<i
nit>()

Here is my custom global repository code:

public class GlobalRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements GlobalRepository<T, ID> {

    private EntityManager em;

    public GlobalRepositoryImpl(Class<T> domainClass, EntityManager em) {
        super(domainClass, em);
        this.em = em;
    }

    public void sharedCustomMethod(ID id) {

    }

}

Here is my xml config:

<repositories base-package="trc.suivi.repository" factory-class="trc.suivi.repository.GlobalRepositoryFactoryBean">
        <repository id="pliRepository" />
        <repository id="globalRepository" />
    </repositories>

I was not able to find any other sample on the web. Can anyone please help?

  • 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-06-08T04:05:15+00:00Added an answer on June 8, 2026 at 4:05 am

    I finally got some help and was able to get my repository to work by using the @NoRepositoryBean annotation on the intermediate interface.

    Further info is available here: http://forum.springsource.org/showthread.php?128536-Several-issues-with-quot-adding-custom-behaviour-to-all-repositories-quot-in-spring-data-jpa

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

Sidebar

Related Questions

I am in reference to the following Spring documentation: http://static.springsource.org/spring-data/data-jpa/docs/1.1.0.RELEASE/reference/html/#repositories.custom-behaviour-for-all-repositories I am trying to
I am able to use Query Cache with Spring Data JPA for my custom
I'm trying to wire up Spring Data JPA objects manually so that I can
Here is the problem. I have spring 3.0.5, using its new DATA JPA repository
Does anyone have an idea how I can use Spring Data JPA and use
i have the following problem. I use Spring and JPA (Hibernate) to persist Data
I am very new to use spring-data-jpa, but it looks very promising. I used
I am attempting to add Spring Data JPA to my project so I can
I am trying to get my data from a query string, but use it
I am trying to use Spring to inject @PersistenceContext entityManager into my service. The

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.