Dynamo / DB Spring“非托管类型”休眠异常

时间:2019-09-15 21:11:07

标签: 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 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)
    }
}
@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
}

这是我最初的DynamoDb尝试,我看不到Spring无法扫描上述类的地方。

0 个答案:

没有答案