Java tutorial
/* * Copyright 2010-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ifeng.vdn.report.rest.data.mongodb; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.config.AbstractMongoConfiguration; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; import com.mongodb.Mongo; import com.mongodb.MongoClient; import com.mongodb.WriteConcern; /** * @version 1.0.0 * * @author Hefei Li * * @since Jul 7, 2015 */ @Configuration @ComponentScan @EnableMongoRepositories public class ApplicationConfiguration extends AbstractMongoConfiguration { /*@Override public CustomConversions customConversions() { return new CustomConversions(converters); }*/ @Override protected String getDatabaseName() { return "ip-repo"; } @Override public Mongo mongo() throws Exception { MongoClient mongo = new MongoClient(); mongo.setWriteConcern(WriteConcern.SAFE); return mongo; } /*@Autowired private List<Converter<?, ?>> converters;*/ }