/**
* MongoDB配置
*/
@Configuration
public class MongoDBConfig
{
private MappingMongoConverter converter;
/*
* 系统内部使用的类型转换器都在这里设置
*/
@Autowired
public void setMappingMongoConverter(MappingMongoConverter converter)
{
// 设置mongodb不保存 _class字段
converter.setTypeMapper(new DefaultMongoTypeMapper(null));
GenericConversionService conversionService = GenericConversionService.class.cast(
converter.getConversionService());
// 这里是设置自定义枚举类型转换器
conversionService.addConverter(new Int2OrderStatusConverter());
conversionService.addConverter(new OrderStatus2IntConverter());
conversionService.addConverter(new Int