如何在Spring boot中将MultiMap存储到mongo db中?

时间:2017-01-20 10:51:14

标签: java spring mongodb guava

我正在尝试存储一个特殊的guava集合来存储报告,但是当spring应用程序启动时出现错误。

这是错误:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'repositoryEntityController' defined in URL [jar:file:/C:/Users/mirel/.m2/repository/org/springframework/data/spring-data-rest-webmvc/2.5.6.RELEASE/spring-data-rest-webmvc-2.5.6.RELEASE.jar!/org/springframework/data/rest/webmvc/RepositoryEntityController.class]: Unsatisfied dependency expressed through constructor parameter 4; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultConversionService' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.DefaultFormattingConversionService]: Factory method 'defaultConversionService' threw exception; nested exception is java.lang.NullPointerException

这是模型:

public class Report {

    @Id
    private String id;
    private Calendar date;
    private BiMap<String, Multimap<String, String>> data;

    public Report() {
    }

    public Calendar getDate() {
        return date;
    }

    public void setDate(Calendar date) {
        this.date = date;
    }

    public BiMap<String, Multimap<String, String>> getData() {
        return data;
    }

    public void setData(BiMap<String, Multimap<String, String>> data) {
        this.data = data;
       }
  }

存储库:

public interface ReportRepository extends MongoRepository<Report, String>{
}

我认为defaultConversionService无法从Guava库中保存MultiMap数据类型。如何保存报告模型?

0 个答案:

没有答案