You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting error You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
#348
Open
dulshand opened this issue
Jul 11, 2021
· 0 comments
Repository method should return records as per filter criteria stated in @query
Actual Behavior
During the springboot application start up it fails with below error Getting error You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
Complete error:
2021-07-11 15:45:34.632 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : Spring Data DynamoDB Version: 5.2.5 (2.2)
2021-07-11 15:45:34.634 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : Spring Data Version: 2.0.9.RELEASE
2021-07-11 15:45:34.635 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : AWS SDK Version: 1.11.771
2021-07-11 15:45:34.635 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : Java Version: 11.0.4 - OpenJDK 64-Bit Server VM 11.0.4+10-b304.77
2021-07-11 15:45:34.635 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : Platform Details: Windows 10 10.0
2021-07-11 15:45:34.635 WARN 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : This Spring Data DynamoDB implementation might not be compatible with the available Spring Data classes on the classpath!
NoDefClassFoundExceptions or similar might occur!
2021-07-11 15:45:34.823 WARN 30940 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamoDbController': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamoDbRepository': Unsatisfied dependency expressed through field 'myCRUDRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myCRUDRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
2021-07-11 15:45:34.828 INFO 30940 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
Steps to Reproduce the Problem
Create springboot app with
org.springframework.boot
spring-boot-starter-parent
2.0.4.RELEASE
org.springframework.boot
spring-boot-starter-web
com.amazonaws
aws-java-sdk-dynamodb
1.11.771
io.github.boostchicken
spring-data-dynamodb
5.2.5
org.springframework.boot
spring-boot-starter-test
test
1. Then create a custom crud Repository
@DynamoDBTable(tableName = "student")
public class Student implements Serializable {
private static final long serialVersionUID = 1L;
@DynamoDBHashKey(attributeName = "studentId")
public String getId() {
return (id != null)?id.getStudentId():null;
}
public void setId(String studentId) {
if (this.id == null) {
this.id = new StudentKey(studentId);
} else {
this.id.setStudentId(studentId);
}
}
@Id
StudentKey id;
@DynamoDBRangeKey(attributeName = "lastName")
public String getLastName() {
return id != null ? id.getLastName() : null;
}
public void setLastName(String lastName) {
if (this.id == null) {
this.id = new StudentKey();
}
this.id.setLastName(lastName);
}
private String firstName;
private String age;
private Address address;
@DynamoDBAttribute
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@DynamoDBAttribute
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
@DynamoDBAttribute
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
}
main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : This Spring Data DynamoDB implementation might not be compatible with the available Spring Data classes on the classpath!
Specifications
Spring Data DynamoDB Version: 5.2.5 (2.2)
Spring Data Version: 2.0.9.RELEASE
AWS SDK Version: 1.11.771
Java Version: 11.0.4 - OpenJDK 64-Bit Server VM 11.0.4+10-b304.77
Platform Details: Windows 10 10.0
All those information are logged by org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory on INFO level on startup.
Or use java -version and mvn dependency:tree | grep -E 'spring|aws' to provide those version numbers.
The text was updated successfully, but these errors were encountered:
Expected Behavior
Repository method should return records as per filter criteria stated in @query
Actual Behavior
During the springboot application start up it fails with below error
Getting error You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
Complete error:
2021-07-11 15:45:34.632 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : Spring Data DynamoDB Version: 5.2.5 (2.2)
2021-07-11 15:45:34.634 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : Spring Data Version: 2.0.9.RELEASE
2021-07-11 15:45:34.635 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : AWS SDK Version: 1.11.771
2021-07-11 15:45:34.635 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : Java Version: 11.0.4 - OpenJDK 64-Bit Server VM 11.0.4+10-b304.77
2021-07-11 15:45:34.635 INFO 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : Platform Details: Windows 10 10.0
2021-07-11 15:45:34.635 WARN 30940 --- [ main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : This Spring Data DynamoDB implementation might not be compatible with the available Spring Data classes on the classpath!
NoDefClassFoundExceptions or similar might occur!
2021-07-11 15:45:34.823 WARN 30940 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamoDbController': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dynamoDbRepository': Unsatisfied dependency expressed through field 'myCRUDRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myCRUDRepository': Invocation of init method failed; nested exception is java.lang.IllegalStateException: You have defined query method in the repository but you don't have any query lookup strategy defined. The infrastructure apparently does not support query methods!
2021-07-11 15:45:34.828 INFO 30940 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
Steps to Reproduce the Problem
package com.springboot.repository;
import com.springboot.model.Student;
import com.springboot.model.StudentKey;
import org.socialsignin.spring.data.dynamodb.repository.EnableScan;
import org.socialsignin.spring.data.dynamodb.repository.ExpressionAttribute;
import org.socialsignin.spring.data.dynamodb.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
@EnableScan
public interface MyCRUDRepository extends CrudRepository<Student, StudentKey> {
@query(filterExpression = "contains(#field, :value)",
expressionMappingNames = {@ExpressionAttribute(key = "#field", value = "firstName")},
expressionMappingValues = {@ExpressionAttribute(key=":value", parameterName = "firstName")})
List findList(@param("firstName") String firstName);
}
Model Classes:
package com.springboot.model;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBRangeKey;
import java.io.Serializable;
public class StudentKey implements Serializable {
private static final long serialVersionUID = 2310511711421469613L;
}
package com.springboot.model;
import java.io.Serializable;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBDocument;
@DynamoDBDocument
public class Address implements Serializable {
}
package com.springboot.model;
import java.io.Serializable;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBRangeKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;
import org.springframework.data.annotation.Id;
@DynamoDBTable(tableName = "student")
public class Student implements Serializable {
}
main] o.s.s.d.d.r.s.DynamoDBRepositoryFactory : This Spring Data DynamoDB implementation might not be compatible with the available Spring Data classes on the classpath!
Specifications
All those information are logged by
org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory
onINFO
level on startup.Or use
java -version
andmvn dependency:tree | grep -E 'spring|aws'
to provide those version numbers.The text was updated successfully, but these errors were encountered: