derjust / spring-data-dynamodb

This module deals with enhanced support for a data access layer built on AWS DynamoDB.
https://derjust.github.io/spring-data-dynamodb/
Apache License 2.0
403 stars 141 forks source link

Spring 2.1.2 bean creation exception #237

Open danieleforberg opened 5 years ago

danieleforberg commented 5 years ago

Expected Behavior

Setup dynamo db

Actual Behavior

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamoDB-DynamoDBMapper': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory.<init>()
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1270)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1164)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:974)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:848)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:574)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:514)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:477)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:471)
    at org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration$DevToolsDataSourceCondition.getMatchOutcome(DevToolsDataSourceAutoConfiguration.java:164)
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
    ... 42 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory.<init>()
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:83)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1262)
    ... 51 more
Caused by: java.lang.NoSuchMethodException: org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory.<init>()
    at java.base/java.lang.Class.getConstructor0(Class.java:3350)
    at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2554)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78)
    ... 52 more

Steps to Reproduce the Problem

  1. Start spring Boot app or run It test

Specifications

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.

pmalon commented 5 years ago

I am getting the same error even with spring boot 2.1.0.RELEASE

danieleforberg commented 5 years ago

Ok worked for me using 5.0.4 version and 2.0.9 of Spring data commons and 2.1.2 spring boot version. Maybe works if downgrading Spring data commons to The version supported 5.1.0 have not tested that yet

Skaffa Outlook för Androidhttps://aka.ms/ghei36


From: Paweł notifications@github.com Sent: Sunday, February 10, 2019 10:19:24 AM To: derjust/spring-data-dynamodb Cc: Daniel Förberg; Author Subject: Re: [derjust/spring-data-dynamodb] Spring 2.1.2 bean creation exception (#237)

I am getting the same error even with spring boot 2.1.0.RELEASE

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/derjust/spring-data-dynamodb/issues/237#issuecomment-462116561, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhaQuBx4DRMjvSRvM_uHUm8jEmHsoQmgks5vL-QcgaJpZM4avrjz.

kdallmeyer-sr commented 5 years ago

I am having this issue too. Seems like a blocker to use this library with Spring Boot 2.1.

@danieleforberg what did you do to downgrade the versions in Maven or Gradle?

danieleforberg commented 5 years ago

I have tried but did not have any success wheter is not a configuration issue it is bug that stops using 5.1.0 not working as exspected. It says it should support this version but not. Do you need more information from me? Config?

Skaffa Outlook för Androidhttps://aka.ms/ghei36


From: Ken Dallmeyer notifications@github.com Sent: Wednesday, February 13, 2019 4:12:11 AM To: derjust/spring-data-dynamodb Cc: Daniel Förberg; Mention Subject: Re: [derjust/spring-data-dynamodb] Spring 2.1.2 bean creation exception (#237)

I am having this issue too. Seems like a blocker to use this library with Spring Boot 2.1.

@danieleforberghttps://github.com/danieleforberg what did you do to downgrade the versions in Maven or Gradle?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/derjust/spring-data-dynamodb/issues/237#issuecomment-463039366, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhaQuEM4juaLuVfXuSGER-D84MdbUluhks5vM4KLgaJpZM4avrjz.

kdallmeyer-sr commented 5 years ago

In Gradle, by manually adding org.springframework.data:spring-data-commons:2.0.11.RELEASE, it overwrote what spring boot 2.1 was using so that it is compatible with the 5.0.4 version.

    compile "com.amazonaws:aws-java-sdk-dynamodb:1.11.490"
    compile "org.springframework.data:spring-data-commons:2.0.11.RELEASE"
    compile "com.github.derjust:spring-data-dynamodb:5.0.4"
danieleforberg commented 5 years ago

Ok but 5.1.0 does not work

Skaffa Outlook för Androidhttps://aka.ms/ghei36


From: Ken Dallmeyer notifications@github.com Sent: Wednesday, February 13, 2019 4:44:58 PM To: derjust/spring-data-dynamodb Cc: Daniel Förberg; Mention Subject: Re: [derjust/spring-data-dynamodb] Spring 2.1.2 bean creation exception (#237)

In Gradle, by manually adding org.springframework.data:spring-data-commons:2.0.11.RELEASE, it overwrote what spring boot 2.1 was using so that it is compatible with the 5.0.4 version.

compile "com.amazonaws:aws-java-sdk-dynamodb:1.11.490"
compile "org.springframework.data:spring-data-commons:2.0.11.RELEASE"
compile "com.github.derjust:spring-data-dynamodb:5.0.4"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/derjust/spring-data-dynamodb/issues/237#issuecomment-463248968, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhaQuNg5kvrYc-Yv_-3jQt5MypO7fdqEks5vNDL6gaJpZM4avrjz.

danieleforberg commented 5 years ago

It is the same as #230 even if it not happen specifically in a test. It will happen both in test and when starting boot. Seems wrong constructor definition in factorybean

Skaffa Outlook för Androidhttps://aka.ms/ghei36


From: Ken Dallmeyer notifications@github.com Sent: Wednesday, February 13, 2019 4:44:58 PM To: derjust/spring-data-dynamodb Cc: Daniel Förberg; Mention Subject: Re: [derjust/spring-data-dynamodb] Spring 2.1.2 bean creation exception (#237)

In Gradle, by manually adding org.springframework.data:spring-data-commons:2.0.11.RELEASE, it overwrote what spring boot 2.1 was using so that it is compatible with the 5.0.4 version.

compile "com.amazonaws:aws-java-sdk-dynamodb:1.11.490"
compile "org.springframework.data:spring-data-commons:2.0.11.RELEASE"
compile "com.github.derjust:spring-data-dynamodb:5.0.4"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/derjust/spring-data-dynamodb/issues/237#issuecomment-463248968, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhaQuNg5kvrYc-Yv_-3jQt5MypO7fdqEks5vNDL6gaJpZM4avrjz.

Rachit-rkb commented 5 years ago

@derjust could you please do something about this issue.

piclemx commented 5 years ago

We got the same problem when upgrading to the latest version of springboot

TravellerVS commented 5 years ago

We are also experiencing a similar problem. springboot 2.1.2.RELEASE and spring-data-dynamodb.version 5.1.0

shexbeer commented 5 years ago

Here the same. Its really a bug issue because spring boot 2.1.x is needed to get all the latest goodies from spring-security-oauth2-jose

boostchicken commented 5 years ago

5.1.0 only works with LoveLace, if you are using something before it it will not work

boostchicken commented 5 years ago

I have Spring Boot 2.1.3 running on 5.1.0 just fine here is come of the config make sure you using the BOM for Spring Data and not hardcoding dependencies versions, Note that this will move you to the Spring Data 2.1.x release train (Lovelace)

ext {
    springDataVersion = 'Lovelace-SR5'
}
buildscript {
    repositories {
        mavenCentral()
        jcenter()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.3.RELEASE")
        classpath "io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE"
    }
}

apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

dependencyManagement {
    imports {
        mavenBom "org.springframework.data:spring-data-releasetrain:${springDataVersion}"
    }
}

dependencies {
    implementation  "org.springframework.boot:spring-boot-starter-web"
    implementation  group: 'com.github.derjust', name: 'spring-data-dynamodb', version: '5.1.0'
    implementation  'com.amazonaws:aws-java-sdk-dynamodb:1.11.497'
}

Work's great here

boostchicken commented 5 years ago

Also you do have to setup your DynamoMapper, here is a snippet

    @Bean
    public AmazonDynamoDB amazonDynamoDB()
    {
        Region region = Regions.getCurrentRegion();
        if(region == null) {
            region = RegionUtils.getRegion(this.region); // This is brought in from a prop file, do it however you want
        }
        return AmazonDynamoDBClientBuilder.standard().withRegion(region.getName()).build();
    }

    @Bean
    @Primary
    public DynamoDBMapper dynamoDBMapper(AmazonDynamoDBClient amazonDynamoDBClient, DynamoDBMapperConfig dynamoDBMapperConfig)
    {
        return new DynamoDBMapper(amazonDynamoDBClient, dynamoDBMapperConfig);
    }

    @Bean
    public DynamoDBMapperConfig dynamoDBMapperConfig() {
        DynamoDBMapperConfig.Builder builder = new DynamoDBMapperConfig.Builder();
        builder.setPaginationLoadingStrategy(DynamoDBMapperConfig.PaginationLoadingStrategy.LAZY_LOADING);
        builder.setTypeConverterFactory(DynamoDBTypeConverterFactory.standard());
        return builder.build();
    }

    @Bean
    public DynamoDB dynamoDB(AmazonDynamoDB amazonDynamoDB)
    {
        return new DynamoDB(amazonDynamoDB);
    }
boostchicken commented 5 years ago

Also tested against Moore M2, works good.

shexbeer commented 5 years ago

Cannot reconstruct your success. Using maven with spring boot 2.1.3 Also added dependency:

<dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-releasetrain</artifactId>
            <version>Lovelace-SR5</version>
</dependency>

Also used your config ... still getting the same error

shexbeer commented 5 years ago

@boostchicken Also tried the example project from #230 (https://github.com/pluttrell/spring-data-dynamodb-5.1.0-issue) with your example configuration and still getting same error

tiagocpeixoto commented 5 years ago

@shexbeer

Could you test the fix I made?

It was an object of a pull request.

Best regards.

shexbeer commented 5 years ago

Hi @tiagocpeixoto,

i tried your fix and it actually solved the issue for me. So i can confirm that your PR fixes the issue!

Best regards,

gruutak commented 5 years ago

@boostchicken couldn't make it work even with the changes you suggested. Getting the same error.

Anyone else got it working with Spring Boot 2.1.2 or 2.1.3?

boostchicken commented 5 years ago

@gruutak It's impossible for me to say why this works for me and couple others and not for you. I'd be curious to look at your code and see where it differs, totally understand if that's not possible. There is the open PR for @tiagocpeixoto that you could checkout and build locally and see if it fixes your issue.

agodoy commented 5 years ago

hello im trying to use this lib with QueryByExampleExecutor, i.e. Query by Example https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#query-by-example and fail with this error>

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gatesServiceImpl': Unsatisfied dependency expressed through field 'eventsRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventsRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property exists found for type Events! at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1341) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) [spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) [spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar!/:2.0.5.RELEASE] at com.mobilenik.rekonpeople.RekonPeopleApplication.main(RekonPeopleApplication.java:19) [classes!/:0.0.1] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [rekonpeopleApi-0.0.1.jar:0.0.1] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [rekonpeopleApi-0.0.1.jar:0.0.1] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [rekonpeopleApi-0.0.1.jar:0.0.1] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [rekonpeopleApi-0.0.1.jar:0.0.1] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventsRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property exists found for type Events! at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:583) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] ... 27 common frames omitted Caused by: org.springframework.data.mapping.PropertyReferenceException: No property exists found for type Events! at org.springframework.data.mapping.PropertyPath.(PropertyPath.java:94) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:358) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:334) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:287) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324) ~[na:1.8.0_201] at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:269) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:252) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.query.parser.Part.(Part.java:81) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:250) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_201] at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[na:1.8.0_201] at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_201] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_201] at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_201] at org.springframework.data.repository.query.parser.PartTree$OrPart.(PartTree.java:251) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:380) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_201] at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[na:1.8.0_201] at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_201] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_201] at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_201] at org.springframework.data.repository.query.parser.PartTree$Predicate.(PartTree.java:381) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.query.parser.PartTree.(PartTree.java:93) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.socialsignin.spring.data.dynamodb.repository.query.PartTreeDynamoDBQuery.(PartTreeDynamoDBQuery.java:37) ~[spring-data-dynamodb-5.0.4.jar!/:5.0.4] at org.socialsignin.spring.data.dynamodb.repository.query.DynamoDBQueryLookupStrategy$CreateQueryLookupStrategy.createDynamoDBQuery(DynamoDBQueryLookupStrategy.java:94) ~[spring-data-dynamodb-5.0.4.jar!/:5.0.4] at org.socialsignin.spring.data.dynamodb.repository.query.DynamoDBQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.createDynamoDBQuery(DynamoDBQueryLookupStrategy.java:152) ~[spring-data-dynamodb-5.0.4.jar!/:5.0.4] at org.socialsignin.spring.data.dynamodb.repository.query.DynamoDBQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(DynamoDBQueryLookupStrategy.java:69) ~[spring-data-dynamodb-5.0.4.jar!/:5.0.4] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:565) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:558) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[na:1.8.0_201] at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[na:1.8.0_201] at java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1049) ~[na:1.8.0_201] at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[na:1.8.0_201] at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[na:1.8.0_201] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_201] at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[na:1.8.0_201] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:560) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:550) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at java.util.Optional.map(Optional.java:215) ~[na:1.8.0_201] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.(RepositoryFactorySupport.java:550) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:323) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$4(RepositoryFactoryBeanSupport.java:290) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.util.Lazy.getNullable(Lazy.java:141) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.util.Lazy.get(Lazy.java:63) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:293) ~[spring-data-commons-2.0.10.RELEASE.jar!/:2.0.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695) ~[spring-beans-5.0.9.RELEASE.jar!/:5.0.9.RELEASE] ... 37 common frames omitted

Specifications Spring Data DynamoDB Version: 5.0.4 AWS SDK Version: 1.11.163 Java Version: 8 Platform Details: Spring Boot 2.0.5 RELEASE

Can you help me???!

gruutak commented 5 years ago

@boostchicken Unfortunately, I can't share the code with you.

Trying the fix I got the same error when running the tests, but a slightly different error running the app with the versions you recommended above and the exact same setup for DynamoMapper:

-java.lang.NoSuchMethodException: org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory.<init>()
    at java.base/java.lang.Class.getConstructor0(Class.java:3350) ~[na:na]
    at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2554) ~[na:na]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:78) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 30 common frames omitted
Wrapped by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory.<init>()
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:83) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1279) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 29 common frames omitted
Wrapped by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamoDB-DynamoDBMapper': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory.<init>()
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1287) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1181) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:991) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:865) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:574) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:514) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:477) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:227) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1411) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1210) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 17 common frames omitted
Wrapped by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'traceHookRegisteringBeanDefinitionRegistryPostProcessor' defined in class path resource [org/springframework/cloud/sleuth/instrument/reactor/TraceReactorAutoConfiguration$TraceReactorConfiguration.class]: Unsatisfied dependency expressed through method 'traceHookRegisteringBeanDefinitionRegistryPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dynamoDB-DynamoDBMapper': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.socialsignin.spring.data.dynamodb.repository.config.DynamoDBMapperFactory.<init>()
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:509) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1305) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1144) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at com.ibanking.enterprise.APIStarter.main(APIStarter.java:24) ~[main/:na]
gruutak commented 5 years ago

Ok, I got it working with the fix. Turns out spring-data-redis was messing stuff up. I had it configured to use a specific version. Started working when I removed the version so it would use the mavenBom

dharbuzov commented 5 years ago

By reason of project requirements I can't change version of Spring Boot and also should support ddl auto for all entities (only version 5.1.0 supports this feature ). I've fixed this problem by the following workaround , enabling override the spring beans(be careful with it!!!) you should define @Primary beans:

spring.main.allow-bean-definition-overriding=true

Then in my DynamoDBConfiguration class override DynamoDBMapperFactory bean with allowed constructor and set as primary bean for name 'dynamoDB-DynamoDBMapper':

    @Primary
    @Bean(name = "dynamoDB-DynamoDBMapper")
    public DynamoDBMapperFactory dynamoDBMapperFactory() {
        return new DynamoDBMapperFactory(amazonDynamoDB(), dynamoDBMapperConfig());
    }
SimY4 commented 5 years ago

Fixing the version of spring-beans dependency to 5.1.6.RELEASE fixes this issue for me but surfaces more issues...

<dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>5.1.6.RELEASE</version>
</dependency>
andyhayes commented 5 years ago

Updating to spring-boot ~5.1.4.RELEASE~ 2.1.4.RELEASE resolved this issue for us

Edit: version number typo