DynamoDB and TableNameOverride with prefix

前端 未结 3 1559
[愿得一人]
[愿得一人] 2021-02-20 01:54

I am testing DynamoDB tables and want to set up different table names for prod and dev environment using the prefix \"dev_\" for development.

I made this test to print t

3条回答
  •  终归单人心
    2021-02-20 02:34

    I've faced the same situation and struggled with myself a couple of days to get that working.

    Just in case you're using DynamoDB + Spring here is what worked for me:

    POJO class:

    @DynamoDBTable(tableName = "APP-ACCESSKEY")
    public class AccessKey {
        @NotBlank
        @Size(min = 1, max = 36)
        private String accessToken;
    
        @NotNull
        @Size(min = 3, max = 15)
        private String userName;
    
        private Date dateInsertion;
    
    
        public AccessKey() {
    
        // ... All POJO stuff
    }
    

    Spring configuration:

    
    
    
        
        
            
            
        
    
        
            
        
    
        
             
             
        
    
        
            
            
        
    
        
            
            
        
    
    
    

    Explanation:

    Taking into account that my AccessKey object point to APP-ACCESSKEY table on AWS DynamodDB then it turns out that after running this, your application will start to point to DES-APP-ACCESSKEY.

    Hope it helps someone who's facing a situation akin to it

    Cheers

提交回复
热议问题