New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redeclared save(Iterable) results in wrong method overload to be invoked eventually [DATACMNS-943] #1398
Comments
Adam Michalik commented I'm running into the same issue in the following setup. Spring Boot 1.4.2, Spring Core 4.3.4, Spring Data Commons 1.12.5, Spring Data MongoDB 1.9.5. public interface IterableSaveRepository extends MongoRepository<Dummy, String> {
@Override
<S extends Dummy> List<S> save(Iterable<S> entites);
} @Document(collection = "dummy")
public class Dummy {
@Id
private String id;
// constructors, getters, setters etc.
} import java.util.List;
import com.github.fakemongo.Fongo;
import com.mongodb.Mongo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.test.context.junit4.SpringRunner;
import static com.google.common.collect.Lists.*;
import static org.assertj.core.api.Assertions.*;
@RunWith(SpringRunner.class)
@SpringBootTest
public class IterableSaveRepositoryTest {
@Autowired
private IterableSaveRepository repository;
@Test
public void queryByApplicationNumberAndFilePath() {
repository.save(newArrayList(new Dummy("test")));
List<Dummy> items = repository.findAll();
assertThat(items).containsOnly(new Dummy("test"));
}
@Configuration
@EnableMongoRepositories
static class Config extends AbstractMongoConfiguration {
@Override
protected String getDatabaseName() {
return "test";
}
@Override
public Mongo mongo() throws Exception {
return new Fongo("inmemory-mongodb").getMongo();
}
}
} The
When I remove the overriding method from I've narrowed it down to My aim was to not inherit from |
Oliver Drotbohm commented Any chance we can get a sample project that's reproducing that error? Ideally something that fails when executing |
Adam Michalik commented Here's a sample project corresponding to my previous comment. Right now the |
Adam Michalik commented To be precise, the issue occurs also when the |
Oliver Drotbohm commented This should be fixed. Feel free to give the snapshots a try |
Adam Michalik commented Confirmed with 1.12.6.BUILD-SNAPSHOT that it works fine. Thanks! |
Niranjan Kurra opened DATACMNS-943 and commented
I have upgrade my project from spring boot 1.3.1 to 1.4.1.
After the update the code seems to behave fine in windows with java 1.8.0_45 64bit
But in jenkins server (on linux) with the same java version the code breaks with this exception
The invoking call is ```
myRepository.save(Arrays.asList(new MyEntity(1, "foo"), new MyEntity(2, "bar")));
Affects: 1.12.5 (Hopper SR5)
Attachments:
Issue Links:
DATACMNS-1023 Redeclared reactive delete(Serializable) results in wrong method overload to be invoked eventually
DATACMNS-945 Prefer direct matches on reactive repository query method overloads
Backported to: 1.13 RC1 (Ingalls), 1.12.6 (Hopper SR6), 1.11.7 (Gosling SR7)
1 votes, 5 watchers
The text was updated successfully, but these errors were encountered: