org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper Java Examples
The following examples show how to use
org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MongoConfiguation.java From HA-DB with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Bean public MongoTemplate mongoTemplate(MongoDbFactory mongoDbFactory, SequenceOption sequenceOption) { DbRefResolver dbRefResolver = new DefaultDbRefResolver(mongoDbFactory); MongoCustomConversions conversions = new MongoCustomConversions(resolverConverter()); MongoMappingContext mappingContext = new BHBMongoMappingContext(); mappingContext.setSimpleTypeHolder(conversions.getSimpleTypeHolder()); mappingContext.afterPropertiesSet(); MappingMongoConverter converter = new MappingMongoConverter(dbRefResolver, mappingContext); // _class 剔除 converter.setTypeMapper(new DefaultMongoTypeMapper(null)); converter.setCustomConversions(conversions); converter.afterPropertiesSet(); // 需要自增时 // MongoTemplate template=new DTXDMongoTemplate(mongoDbFactory,converter, // sequenceOption); MongoTemplate template = new MongoTemplate(mongoDbFactory, converter); return template; }
Example #2
Source File: TxManagerConfiguration.java From Lottor with MIT License | 5 votes |
@Bean @Override public MappingMongoConverter mappingMongoConverter() throws Exception { MappingMongoConverter mmc = super.mappingMongoConverter(); mmc.setTypeMapper(new DefaultMongoTypeMapper(null)); return mmc; }
Example #3
Source File: MultipleMongoConfig.java From canal-mongo with Apache License 2.0 | 5 votes |
@Primary @Bean(name = "naiveMongoTemplate") public MongoTemplate naiveMongoTemplate() throws Exception { MappingMongoConverter converter = new MappingMongoConverter(new DefaultDbRefResolver(naiveFactory()), new MongoMappingContext()); converter.setTypeMapper(new DefaultMongoTypeMapper(null)); return new MongoTemplate(naiveFactory(), converter); }
Example #4
Source File: MultipleMongoConfig.java From canal-mongo with Apache License 2.0 | 5 votes |
@Bean @Qualifier("completeMongoTemplate") public MongoTemplate completeMongoTemplate() throws Exception { MappingMongoConverter converter = new MappingMongoConverter(new DefaultDbRefResolver(completeFactory()), new MongoMappingContext()); converter.setTypeMapper(new DefaultMongoTypeMapper(null)); return new MongoTemplate(completeFactory(), converter); }
Example #5
Source File: KyMongoConfig.java From ClusterDeviceControlPlatform with MIT License | 5 votes |
@Bean @Override public MappingMongoConverter mappingMongoConverter() throws Exception { MappingMongoConverter mmc = super.mappingMongoConverter(); //remove _class mmc.setTypeMapper(new DefaultMongoTypeMapper(null)); return mmc; }
Example #6
Source File: KyMongoConfig.java From ClusterDeviceControlPlatform with MIT License | 5 votes |
@Override public MappingMongoConverter mappingMongoConverter() throws Exception { MappingMongoConverter mmc = super.mappingMongoConverter(); //remove _class mmc.setTypeMapper(new DefaultMongoTypeMapper(null)); return mmc; }
Example #7
Source File: $ Spring Data MongoDB Setup.java From allegro-intellij-templates with Apache License 2.0 | 5 votes |
@Bean(name = "mongoTemplate") public MongoTemplate createMongoTemplate() throws UnknownHostException { MongoClient mongoClient = new MongoClient(host, port); //TODO Configure additional MongoDB mongoClient settings if needed MongoDbFactory factory = new SimpleMongoDbFactory(mongoClient, database, new UserCredentials(username, password)); MappingMongoConverter converter = new MappingMongoConverter(new DefaultDbRefResolver(factory), new MongoMappingContext()); converter.setTypeMapper(new DefaultMongoTypeMapper(null)); return new MongoTemplate(factory, converter); }
Example #8
Source File: MongoConverterIgnoreClassNameFactoryBean.java From howsun-javaee-framework with Apache License 2.0 | 4 votes |
@Override public MappingMongoConverter getObject() throws Exception { MongoTypeMapper typeMapper = new DefaultMongoTypeMapper(null); converter.setTypeMapper(typeMapper); return converter; }