BeanCreationException: Ошибка при создании bean-компонента с именем 'Reposit': сбой вызова метода init - PullRequest
0 голосов
/ 19 октября 2019

При попытке вызвать приложение я получаю сообщение об ошибке ниже. Я пробовал решение mltiple, но, похоже, ни одно из них не работает.

* Причина: org.springframework.beans.factory.BeanCreationException: Ошибка при создании компонента с именем 'testRepository': сбой вызова метода init;Вложенным исключением является java.lang.IllegalArgumentException: не удалось создать запрос для метода public abstract java.util.List com.test.base.repository.TestRespositoryCustom.findResultByCodeAndProfile (java.lang.String, java.lang.String)! Не найдено свойство findResultByCodeAndProfile для типа Test!

................ ................

............ 47 общих кадров опущены. Причина: org.springframework.data.mapping.PropertyReferenceException: не найдено свойство findResultByCodeAndProfile для типа Test! в org.springframework.data.mapping.PropertyPath. (PropertyPath.java:94) ~ [spring-data-commons-2.1.5.RELEASE.jar: 2.1.5.RELEASE] в org.springframework.data.mapping.PropertyPath.create (PropertyPath.java:382) ~ [spring-data-commons-2.1.5.RELEASE.jar: 2.1.5.RELEASE] *

Мой класс обслуживания вызывает метод findResultByCodeAndProfile, который вызывает интерфейс TestRespositoryCustom иреализация которого приведена ниже в классе TestRespositoryImpl.

"Test.java - это класс сущности"

- Класс обслуживания.

@Autowired
TestRepository testRepository;

     public void getHotelProfileLatestTest(String hotelCode)
    {
        List<TestDto> testList = testRepository.findResultByCodeAndProfile(secondaryCode, "profile");
        //
        //
    }

- Интерфейс TestRepository

public interface TestRepository extends BaseRepository<Test, Long>, TestRepositoryCustom {

    {
    @Query(TestQueries.NOTE_QRY)
    Page<TestDto> getHistory(@Param("Key") String Key,
            @Param("Value") String Value);
    }

- интерфейс BaseRepository.

        @NoRepositoryBean
    public interface BaseRepository <T, ID extends Serializable> extends JpaRepository<T, ID>, QueryByExampleExecutor<T>{

}

- TestRespositoryCustom

public interface TestRespositoryCustom
{
    public List<TestDto> findResultByCodeAndProfile(String testObjKey, String testObjValue);
}

- TestRespositoryImpl

public class TestRespositoryImpl extends BaseRepositoryCustom implements TestRespositoryCustom
{
   @Override
    public List<TestDto> findResultByCodeAndProfile(String testObjKey, String testObjValue)
    {
        String sql = TC_NOTE_QRY;
        Query query = entityManager.createQuery(sql);
        query.setMaxResults(3);
        query.setParameter("testObjKey", testObjKey);
        query.setParameter("testObjValue", testObjValue);
        return (List) query.getResultList();
    }

- BaseRepositoryCustom

public class BaseRepositoryCustom {

    @Value("${spring.jpa.properties.hibernate.default_schema}")
    public String defaultSchema;

    @PersistenceContext
    protected EntityManager entityManager;

}
...