简体   繁体   中英

Error initialising MongoDB repository in SpringMVC app

I'm trying to set up a basic Spring MVC app with MongoDB intergration. Using Java 7 JDK

However when trying to build the project with Maven I am seeing a compilation error as follows:

[ERROR] \workspace\apache-analyser\src\main\java\com\apache\analyser\repository\RequestRepository.java:[7,7] 
error: name clash: <S>save(Iterable<S>) in CrudRepository and save(Iterable<? extends T#2>) in MongoRepository have the same erasure, yet neither overrides the other 

Here is the Repository interface:

package com.apache.analyser.repository;

import org.springframework.data.mongodb.repository.MongoRepository;

import com.apache.analyser.domain.Request;

public interface RequestRepository extends MongoRepository<Request, String> {

}

And the Spring configuration to initialise this:

<mongo:repositories base-package="com.apache.analyser.repository" />

It seems like a basic setup I am trying to do so not sure why I am seeing this error. Has anyone seen this or is aware of why this might happen?

I solved my problem by changing spring-data-commons-core version from 1.3.1 to 1.2.1. This last one is used with spring-data-mongodb 1.0.3.

I have solved my issue by reverting to Java 6 JDK. I am not sure why this is not working with Java7 so if anyone is aware It'd be great to hear!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM