Keine Eigenschaft für Typfehler gefunden, wenn versucht wird, ein benutzerdefiniertes Repository mit Spring Data JPA zu erstellen

Habe ich eine Medien-Person, die einige grundlegende Felder für die Dateien die der user hochgeladen hat. Für die Speicherung der bytes der Dateien, die hochgeladen, die ich zum erstellen eines benutzerdefinierten Repositorys, die hält, dass die Funktionalität. Befolgen Sie die Schritte in der Spring-Dokumentation, ich habe ein interface geschaffen, das wie folgt aussieht:

public interface MediaBytesRepository
{
    public byte[] getBytes(Media media) throws IOException;
    public void saveBytes(Media media, byte[] bytes) throws IOException;
    public void appendBytes(Media media, byte[] bytes) throws IOException;
    public void deleteBytes(Media media) throws IOException;
    public boolean bytesExist(Media media) throws IOException;
}

Dann habe ich bereitgestellt, eine Implementierung für diese Schnittstelle aufgerufen MediaBytesRepositoryImpl

Mit dabei, dann habe ich die folgende Schnittstelle:

public interface MediaRepository extends JpaRepository<Media, Long>, MediaBytesRepository
{
}

Jetzt, wenn ich starten Sie den server, bekomme ich die folgende stack-trace:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mediaRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Could not create query metamodel for method public abstract void com.foo.bar.core.media.MediaBytesRepository.saveBytes(com.foo.bar.core.media.Media,byte[]) throws java.io.IOException!
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
.....
Caused by: java.lang.IllegalArgumentException: Could not create query metamodel for method public abstract void com.foo.bar.core.media.MediaBytesRepository.saveBytes(com.foo.bar.core.media.Media,byte[]) throws java.io.IOException!
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:92)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:162)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:68)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:280)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:148)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:125)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:41)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    ... 20 more
 Caused by: java.lang.IllegalArgumentException: No property save found for type class com.foo.bar.core.media.Media
    at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:73)
    at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:92)
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:319)
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:333)
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:301)
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:265)
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:239)
    at org.springframework.data.repository.query.parser.Part.<init>(Part.java:70)
    at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:180)
    at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:260)
    at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:240)
    at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:68)
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:57)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:90)
    ... 27 more

Fand ich diese ähnliche post, aber die Vorschläge dort (alles im gleichen package naming convention) sind Dinge, die ich bin bereits tun. Alle meine Medien-Klassen und Schnittstellen sind im selben Paket, und ich bin mit dem "Impl" - suffix.

Kann jemand bitte etwas Licht auf, warum ich diese Fehlermeldung bekommen und wie ich es beheben kann? Danke.

InformationsquelleAutor der Frage dnc253 | 2012-12-19

Schreibe einen Kommentar