为什么在Spring Boot中使用DynamoDB的复合键时需要ReflectionEntityInformation?

huangapple go评论65阅读模式
英文:

Why ReflectionEntityInformation when using Composite key of DynamoDB in Spring Boot

问题

错误可能出在Spring Data DynamoDB依赖版本的兼容性上。根据你的日志,看起来问题出在找不到org.springframework.data.repository.core.support.ReflectionEntityInformation类。为了解决这个问题,你可以尝试以下几个步骤:

  1. 检查Spring Data DynamoDB版本: 确保你使用的Spring Data DynamoDB版本与你的Spring Boot版本兼容。你可以在Spring Data DynamoDB的文档或者官方仓库中找到关于版本兼容性的信息。

  2. 更新依赖版本: 如果版本不兼容,尝试升级或者降级Spring Data DynamoDB版本,以便与你的Spring Boot版本匹配。

    implementation 'org.springframework.boot:spring-boot-starter-data-dynamodb'
    
  3. 清理和构建: 在你的项目目录下运行以下命令,确保所有依赖被正确下载并且项目被正确构建。

    ./gradlew clean build
    
  4. 检查依赖冲突: 在你的项目中可能存在依赖冲突。你可以运行以下命令来检查依赖关系:

    ./gradlew dependencies
    

    确保没有多个版本的Spring Data DynamoDB库被引入。

  5. 检查@EnableDynamoDBRepositories注解: 确保在AwsDynamoDbConfig类上使用了@EnableDynamoDBRepositories注解,并且basePackages属性指向了你的Repository包路径。

    @Configuration
    @EnableDynamoDBRepositories(basePackages = "com.mukit09.dynamodblearning.repository")
    public class AwsDynamoDbConfig {
        // 配置内容...
    }
    
  6. 考虑删除@EnableScan注解: 如果你的MusicRepository接口不需要扫描整个表,可以尝试删除@EnableScan注解,看看是否能够正常工作。在大多数情况下,不建议在生产环境中使用@EnableScan,因为它会扫描整个表,性能会受到影响。

    public interface MusicRepository extends CrudRepository<Music, MusicId> {
    }
    

完成以上步骤后,尝试重新构建和运行你的应用程序,看看问题是否得到解决。

英文:

I am learning DynamoDb, so was trying to do a basic project using Spring Boot and DynamoDB. I checked these link to run this application successfully, but got failed 为什么在Spring Boot中使用DynamoDB的复合键时需要ReflectionEntityInformation?

  1. https://stackoverflow.com/a/57386532/2952011
  2. http://johnhunsley.blogspot.com/2016/11/spring-data-jpa-with-hash-range-key.html
  3. https://medium.com/@leohoc/dynamodb-and-spring-data-a81c546a1305

For db setup, I used docker. Here is my compose file:

version: &#39;3.7&#39;

services:
  localstack:
    container_name: localstack
    image: localstack/localstack:latest
    environment:
      - DEBUG=1
      - USE_SSL=0
      - AWS_CBOR_DISABLE=1
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOSTNAME=localstack
      - SERVICES=dynamodb
      - AWS_DEFAULT_REGION=us-east-1
    ports:
      - &#39;4566-4583:4566-4583&#39;
    volumes:
      - ${TEMPDIR:-/tmp/localstack}:/var/lib/localstack
      - /var/run/docker.sock:/var/run/docker.sock
      - ./script/init-dynamodb.sh:/docker-entrypoint-initaws.d/init-dynamodb.sh

The script to create tables is here:

#!/bin/bash

# -- &gt; Create DynamoDb Table
echo Creating  DynamoDb \&#39;ItemInfo\&#39; table ...
echo $(awslocal dynamodb create-table --cli-input-json &#39;{
    &quot;TableName&quot;:&quot;ItemInfo&quot;,
    &quot;KeySchema&quot;:
      [
        {&quot;AttributeName&quot;:&quot;id&quot;,&quot;KeyType&quot;:&quot;HASH&quot;}
      ],
      &quot;AttributeDefinitions&quot;:
        [
          {&quot;AttributeName&quot;:&quot;id&quot;,&quot;AttributeType&quot;:&quot;S&quot;}
        ],
        &quot;BillingMode&quot;:&quot;PAY_PER_REQUEST&quot;
  }&#39;
)

echo Creating  DynamoDb \&#39;Music\&#39; table ...

echo $(awslocal dynamodb create-table --cli-input-json &#39;{
    &quot;TableName&quot;:&quot;Music&quot;,
    &quot;KeySchema&quot;:
      [
        {&quot;AttributeName&quot;:&quot;Artist&quot;,&quot;KeyType&quot;:&quot;HASH&quot;},
        {&quot;AttributeName&quot;:&quot;SongTitle&quot;,&quot;KeyType&quot;:&quot;RANGE&quot;}
      ],
      &quot;AttributeDefinitions&quot;:
        [
          {&quot;AttributeName&quot;:&quot;Artist&quot;,&quot;AttributeType&quot;:&quot;S&quot;},
          {&quot;AttributeName&quot;:&quot;SongTitle&quot;,&quot;AttributeType&quot;:&quot;S&quot;}
        ],
      &quot;ProvisionedThroughput&quot;:{
        &quot;WriteCapacityUnits&quot;: 5,
        &quot;ReadCapacityUnits&quot;: 5
      },
      &quot;TableClass&quot;: &quot;STANDARD&quot;
  }&#39;
)

# --&gt; List DynamoDb Tables
echo Listing tables ...
echo $(awslocal dynamodb list-tables)

So after running:

sudo docker compose up -d

when I execute this:

aws --endpoint-url=http://localhost:4566 --region=us-east-1  dynamodb describe-table --table-name Music

I am getting this:

{
    &quot;Table&quot;: {
        &quot;AttributeDefinitions&quot;: [
            {
                &quot;AttributeName&quot;: &quot;Artist&quot;,
                &quot;AttributeType&quot;: &quot;S&quot;
            },
            {
                &quot;AttributeName&quot;: &quot;SongTitle&quot;,
                &quot;AttributeType&quot;: &quot;S&quot;
            }
        ],
        &quot;TableName&quot;: &quot;Music&quot;,
        &quot;KeySchema&quot;: [
            {
                &quot;AttributeName&quot;: &quot;Artist&quot;,
                &quot;KeyType&quot;: &quot;HASH&quot;
            },
            {
                &quot;AttributeName&quot;: &quot;SongTitle&quot;,
                &quot;KeyType&quot;: &quot;RANGE&quot;
            }
        ],
        &quot;TableStatus&quot;: &quot;ACTIVE&quot;,
        &quot;CreationDateTime&quot;: &quot;2023-03-07T14:17:46.287000+06:00&quot;,
        &quot;ProvisionedThroughput&quot;: {
            &quot;LastIncreaseDateTime&quot;: &quot;1970-01-01T06:00:00+06:00&quot;,
            &quot;LastDecreaseDateTime&quot;: &quot;1970-01-01T06:00:00+06:00&quot;,
            &quot;NumberOfDecreasesToday&quot;: 0,
            &quot;ReadCapacityUnits&quot;: 5,
            &quot;WriteCapacityUnits&quot;: 5
        },
        &quot;TableSizeBytes&quot;: 0,
        &quot;ItemCount&quot;: 0,
        &quot;TableArn&quot;: &quot;arn:aws:dynamodb:us-east-1:000000000000:table/Music&quot;,
        &quot;TableId&quot;: &quot;bcce1ab3-8f0c-4b8f-9d55-6c69ec1ef2ad&quot;,
        &quot;Replicas&quot;: [],
        &quot;TableClassSummary&quot;: {
            &quot;TableClass&quot;: &quot;STANDARD&quot;
        }
    }
}

So I believe table creation is okay. Now I am showing the (DynamoDB Table) Music class:

@DynamoDBTable(tableName = &quot;Music&quot;)
public class Music implements Serializable {
    @Id
    private MusicId musicId;

    public Music() {}

    public Music(MusicId musicId) {
        this.musicId = musicId;
    }

    public MusicId getMusicId() {
        return musicId;
    }

    public void setMusicId(MusicId musicId) {
        this.musicId = musicId;
    }

    @DynamoDBHashKey(attributeName = &quot;Artist&quot;)
    public String getArtist() {
        return musicId != null ? musicId.getArtist() : null;
    }
    
    public void setArtist(String artist) {
        if (musicId == null)
            musicId = new MusicId();
        musicId.setArtist(artist);
    }

    @DynamoDBRangeKey(attributeName = &quot;SongTitle&quot;)
    public String getSongTitle() {
        return musicId != null ? musicId.getSongTitle() : null;
    }

    public void setSongTitle(String songTitle) {
        if (musicId == null)
            musicId = new MusicId();
        musicId.setSongTitle(songTitle);
    }
}

Here is MusicId (DynamoDB Document) class:

@DynamoDBDocument
public class MusicId implements Serializable {
    private static final long serialVersionUID = 100L;

    public MusicId() {

    }

    public MusicId(String artist, String songTitle) {
        this.artist = artist;
        this.songTitle = songTitle;
    }

    private String artist;
    private String songTitle;

    @DynamoDBHashKey(attributeName = &quot;Artist&quot;)
    public String getArtist() {
        return artist;
    }

    public void setArtist(String artist) {
        this.artist = artist;
    }

    @DynamoDBRangeKey(attributeName = &quot;SongTitle&quot;)
    public String getSongTitle() {
        return songTitle;
    }

    public void setSongTitle(String songTitle) {
        this.songTitle = songTitle;
    }
}

Here is MusicRepository:

@EnableScan
public interface MusicRepository extends CrudRepository&lt;Music, MusicId&gt; {
}

Here is DynamoDbServiceImpl which implements DynamoDbService:

@Service
public class DynamoDbServiceImpl implements DynamoDbService {
    private final ItemInfoRepository itemInfoRepository;
    private final MusicRepository musicRepository;

    @Autowired
    public DynamoDbServiceImpl(ItemInfoRepository itemInfoRepository, MusicRepository musicRepository) {
        this.itemInfoRepository = itemInfoRepository;
        this.musicRepository = musicRepository;
    }

    @Override
    public void saveItem(ItemInfoDto dto) {
        ItemInfo itemInfo = new ItemInfo();
        itemInfo.setItemName(dto.getItemName());
        itemInfo.setItemUrl(dto.getItemUrl());
        itemInfoRepository.save(itemInfo);
    }

    @Override
    public void saveMusic(MusicDto dto) {
        Music music = new Music();
        music.setArtist(dto.getArtist());
        musicRepository.save(music);
    }
}

And here is the AwsDynamoDbConfig to configure:

@Getter
@Setter
@Configuration
@EnableDynamoDBRepositories(basePackages = &quot;com.mukit09.dynamodblearning.repository&quot;)
public class AwsDynamoDbConfig {
    @Value(&quot;${config.aws.region}&quot;)
    private String region;
    @Value(&quot;${config.aws.dynamodb.url}&quot;)
    private String dynamoDbEndpointUrl;
    @Value(&quot;${config.aws.dynamodb.access-key}&quot;)
    private String accessKey;
    @Value(&quot;${config.aws.dynamodb.secret-key}&quot;)
    private String secretKey;

    @Bean(name = &quot;amazonDynamoDB&quot;)
    public AmazonDynamoDB amazonDynamoDB() {
        return AmazonDynamoDBClientBuilder.standard()
                .withCredentials(getCredentialsProvider())
                .withEndpointConfiguration(getEndpointConfiguration(dynamoDbEndpointUrl))
                .build();
    }

    private EndpointConfiguration getEndpointConfiguration(String url) {
        return new EndpointConfiguration(url, region);
    }

    private AWSStaticCredentialsProvider getCredentialsProvider() {
        return new AWSStaticCredentialsProvider(getBasicAWSCredentials());
    }

    private BasicAWSCredentials getBasicAWSCredentials() {
        return new BasicAWSCredentials(accessKey, secretKey);
    }
}

These are the contents from application.properties:

#dynamoDB
config.aws.region=us-east-1
config.aws.dynamodb.url=http://127.0.0.1:4566
config.aws.dynamodb.access-key=localstack
config.aws.dynamodb.secret-key=localstack

#log
logging.file.name=debug.log
logging.level.root= debug

This is my gradle file (build.gradle):

plugins {
    id &#39;java&#39;
    id &#39;org.springframework.boot&#39; version &#39;2.7.9&#39;
    id &#39;io.spring.dependency-management&#39; version &#39;1.0.15.RELEASE&#39;
}

group = &#39;com.mukit09&#39;
version = &#39;0.0.1-SNAPSHOT&#39;
sourceCompatibility = &#39;11&#39;

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation &#39;org.springframework.boot:spring-boot-starter&#39;
    implementation &#39;org.springframework.boot:spring-boot-starter-web&#39;
    implementation &#39;com.github.derjust:spring-data-dynamodb:5.1.0&#39;
    implementation &#39;com.amazonaws:aws-java-sdk-dynamodb:1.12.420&#39;

    compileOnly &#39;org.projectlombok:lombok&#39;

    annotationProcessor &#39;org.springframework.boot:spring-boot-configuration-processor&#39;
    annotationProcessor &#39;org.projectlombok:lombok&#39;
}

tasks.named(&#39;test&#39;) {
    useJUnitPlatform()
}

When I try to run this application, it is failed keeping this log:

2023-03-07 17:32:17.375 ERROR 68881 --- [           main] o.s.boot.SpringApplication               : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name &#39;dynamoDbController&#39; defined in file [/home/mukit09/code/java/dynamodb-learning/build/classes/java/main/com/mukit09/dynamodblearning/controller/DynamoDbController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name &#39;dynamoDbServiceImpl&#39; defined in file [/home/mukit09/code/java/dynamodb-learning/build/classes/java/main/com/mukit09/dynamodblearning/service/impl/DynamoDbServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;musicRepository&#39; defined in com.mukit09.dynamodblearning.repository.MusicRepository defined in @EnableDynamoDBRepositories declared on AwsDynamoDbConfig: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/repository/core/support/ReflectionEntityInformation
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.25.jar:5.3.25]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.25.jar:5.3.25]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303) ~[spring-boot-2.7.9.jar:2.7.9]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292) ~[spring-boot-2.7.9.jar:2.7.9]
at com.mukit09.dynamodblearning.DynamodbLearningApplication.main(DynamodbLearningApplication.java:10) ~[main/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name &#39;dynamoDbServiceImpl&#39; defined in file [/home/mukit09/code/java/dynamodb-learning/build/classes/java/main/com/mukit09/dynamodblearning/service/impl/DynamoDbServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;musicRepository&#39; defined in com.mukit09.dynamodblearning.repository.MusicRepository defined in @EnableDynamoDBRepositories declared on AwsDynamoDbConfig: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/repository/core/support/ReflectionEntityInformation
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.25.jar:5.3.25]
... 19 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;musicRepository&#39; defined in com.mukit09.dynamodblearning.repository.MusicRepository defined in @EnableDynamoDBRepositories declared on AwsDynamoDbConfig: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/repository/core/support/ReflectionEntityInformation
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.25.jar:5.3.25]
... 33 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/repository/core/support/ReflectionEntityInformation
at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016) ~[na:na]
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621) ~[na:na]
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
at org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBEntityMetadataSupport.getEntityInformation(DynamoDBEntityMetadataSupport.java:125) ~[spring-data-dynamodb-5.1.0.jar:5.1.0]
at org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory.getEntityInformation(DynamoDBRepositoryFactory.java:104) ~[spring-data-dynamodb-5.1.0.jar:5.1.0]
at org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory.getDynamoDBRepository(DynamoDBRepositoryFactory.java:128) ~[spring-data-dynamodb-5.1.0.jar:5.1.0]
at org.socialsignin.spring.data.dynamodb.repository.support.DynamoDBRepositoryFactory.getTargetRepository(DynamoDBRepositoryFactory.java:150) ~[spring-data-dynamodb-5.1.0.jar:5.1.0]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:325) ~[spring-data-commons-2.7.8.jar:2.7.8]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:323) ~[spring-data-commons-2.7.8.jar:2.7.8]
at org.springframework.data.util.Lazy.getNullable(Lazy.java:231) ~[spring-data-commons-2.7.8.jar:2.7.8]
at org.springframework.data.util.Lazy.get(Lazy.java:115) ~[spring-data-commons-2.7.8.jar:2.7.8]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:329) ~[spring-data-commons-2.7.8.jar:2.7.8]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.25.jar:5.3.25]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.25.jar:5.3.25]
... 44 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.data.repository.core.support.ReflectionEntityInformation
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
... 64 common frames omitted
Process finished with exit code 1

As a learner of this stack, definitely I did some mistake. Would you please help me please to find the error I made please?

答案1

得分: 1

这是一个已知问题,你可以在这里这里找到相关信息,因为Spring版本大于2.2的情况下不受支持。

有一个分支可能可以解决这个问题,但我没有进行测试:

https://github.com/boostchicken/spring-data-dynamodb

英文:

This is a known issue, as you can find here and here as Spring > 2.2 is not supported.

There is a fork for which it may work, but I have not tested:

https://github.com/boostchicken/spring-data-dynamodb.

huangapple
  • 本文由 发表于 2023年3月7日 19:44:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75661561.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定