Groovy “发电机/DB弹簧”;“不是托管类型”;休眠异常

Groovy “发电机/DB弹簧”;“不是托管类型”;休眠异常,groovy,spring-data-jpa,amazon-dynamodb,Groovy,Spring Data Jpa,Amazon Dynamodb,Spring/DynamoDb收到“非托管类型”异常 设置: Groovy,Spring 2.1.6,AWS SDK 1.11.59,Spring dynamodb 5.1.0 错误: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'platformCalendarController': Unsatisfied dependency expres

Spring/DynamoDb收到“非托管类型”异常

设置: Groovy,Spring 2.1.6,AWS SDK 1.11.59,Spring dynamodb 5.1.0

错误:

org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'platformCalendarController': 
Unsatisfied dependency expressed through field 'calendarService'; 

nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'calendarService': 
Unsatisfied dependency expressed through field 'applicationCalendarDao'; 

nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'applicationCalendarDao': 
Unsatisfied dependency expressed through field 'applicationCalendarRepository'; 

nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'applicationCalendarRepository': 
Invocation of init method failed; 

nested exception is java.lang.IllegalArgumentException: Not a managed type: 
class com.thezer0team.shredderapi.model.ApplicationCalendarEntity
故障排除: 已验证的配置包括引用的存储库。查看了实体、存储库和配置的注释

@Service
class CalendarService {

    @Autowired
    PlatformCalendarTransform platformCalendarTransform

    @Autowired
    ApplicationCalendarTransform applicationCalendarTransform

    @Autowired
    ApplicationCalendarDao applicationCalendarDao

    @Autowired
    PlatformCalendarDao platformCalendarDao

    @Autowired
    UserDao userDao

    ApplicationCalendarEntity assignNewPlatformToCalendar(PlatformCalendarRequest platformCalendarRequest) {

        PlatformCalendarEntity platformCalendarEntity = platformCalendarTransform.getEntityFromRequest(platformCalendarRequest)

        platformCalendarDao.createNewPlatformCalendar(platformCalendarEntity)

        return applicationCalendarDao.readApplicationCalendarById(platformCalendarRequest.applicationCalendarId.toString())
    }

    ApplicationCalendarResponse getApplicationCalendarResponseFromEntity(ApplicationCalendarEntity applicationCalendarEntity) {


        return applicationCalendarTransform.getResponseFromEntity(applicationCalendarEntity)
    }

    PlatformCalendarEntity createPlatformCalendar(PlatformCalendarRequest platformCalendarRequest) {

        PlatformCalendarEntity platformCalendarEntity = platformCalendarTransform.getEntityFromRequest(platformCalendarRequest)

        return platformCalendarDao.createNewPlatformCalendar(platformCalendarEntity)

    }

    PlatformCalendarResponse getPlatformCalendarResponseFromEntity(PlatformCalendarEntity platformCalendarEntity) {

        return platformCalendarTransform.getResponseFromEntity(platformCalendarEntity)
    }
}

这是我第一次尝试DynamoDb,我看不出Spring扫描上述类失败的地方。

一点也不确定,但是你不需要在
ApplicationCalendarenty
上添加
DynamoDBTable
注释吗?这实际上是原始帖子中的一个错误,谢谢你指出这一点。我在实体上有
@DynamoDBTable
,在存储库上有
@Repository
,但我不知道我需要存储库。你解决了这个问题吗?
@Component
class ApplicationCalendarDao {

    @Autowired
    ApplicationCalendarRepository applicationCalendarRepository



    ApplicationCalendarEntity createNewApplicationCalendar(ApplicationCalendarEntity applicationCalendarEntity) {
        return applicationCalendarRepository.save(applicationCalendarEntity)
    }

    ApplicationCalendarEntity readApplicationCalendarById(String id) {
        return applicationCalendarRepository.findById(id).get()
    }
}
@Repository
@EnableScan
interface ApplicationCalendarRepository extends CrudRepository<ApplicationCalendarEntity, String> {

}
@DynamoDBTable(tableName = "applicationCalendar")
class ApplicationCalendarEntity {

    @DynamoDBHashKey
    @DynamoDBAutoGeneratedKey
    String calendarId

    @DynamoDBAttribute
    BigInteger applicationCalendarId

    @DynamoDBAttribute
    String name

    List<ApplicationCalendarEventEntity> events
}
@DynamoDBTable(tableName = "applicationCalendarEvent")
class ApplicationCalendarEventEntity {

    @DynamoDBHashKey
    @DynamoDBAutoGeneratedKey
    String eventId

    @DynamoDBAttribute
    String nativeEventId
}