本文章主要讲述如何将mongo查询语句出来的东西转换成某个model
MongoTemplate.find(new BasicQuery(obj),XXX.class)
添加配置类
重新定义一下 MongoTemplate
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.