参考了一下网上的帖子 https://stackoverflow.com/questions/23517977/spring-boot-mongodb-how-to-remove-the-class-column

简单的方式是:

 

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;

@Configuration
public class MongoDBConfig implements InitializingBean {

    // 参考:https://stackoverflow.com/questions/23517977/spring-boot-mongodb-how-to-remove-the-class-column
    @Autowired
    @Lazy
    private MappingMongoConverter mappingMongoConverter;

    @Override
    public void afterPropertiesSet() {
        mappingMongoConverter.setTypeMapper(new DefaultMongoTypeMapper(null));
    }
}

 

posted @ 2020-02-29 08:17 我的小时代 阅读(1252) 评论(0) 推荐(0) 编辑
摘要: RedisConnection connection = redisTemplate.getConnectionFactory().getConnection(); Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match("qiyihao-message-notice-list*").co 阅读全文
posted @ 2019-08-21 16:51 我的小时代 阅读(1306) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示