Skip to content

Instantly share code, notes, and snippets.

@greenlaw110
Forked from harlanji/Demo.java
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenlaw110/4266a3692125b2ab56fd to your computer and use it in GitHub Desktop.
Save greenlaw110/4266a3692125b2ab56fd to your computer and use it in GitHub Desktop.
MongoTemplate mongo = ...;
List<Converter> converters = new ArrayList<Converter>();
converters.add(new Converter<DBObject, Participant>() {
public Participant convert(DBObject s) {
throw new UnsupportedOperationException("Not supported yet 1.");
}
});
converters.add(new Converter<Participant, DBObject>() {
public DBObject convert(Participant s) {
throw new UnsupportedOperationException("Not supported yet 2.");
}
});
CustomConversions cc = new CustomConversions(converters);
MappingMongoConverter mmc = (MappingMongoConverter)mongo.getConverter();
mmc.setCustomConversions(cc);
mmc.afterPropertiesSet()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment