Move MongoTemplateAutoConfiguration to mongo package
This commit is contained in:
parent
01775ba53d
commit
006d7b6931
|
|
@ -60,4 +60,5 @@ public class MongoAutoConfiguration {
|
||||||
this.mongo = this.properties.createMongoClient();
|
this.mongo = this.properties.createMongoClient();
|
||||||
return this.mongo;
|
return this.mongo;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.boot.autoconfigure.data;
|
package org.springframework.boot.autoconfigure.mongo;
|
||||||
|
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
|
@ -22,11 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.mongo.MongoProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
|
||||||
|
|
||||||
import com.mongodb.Mongo;
|
import com.mongodb.Mongo;
|
||||||
|
|
||||||
|
|
@ -43,7 +41,6 @@ import com.mongodb.Mongo;
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
* @author Josh Long
|
* @author Josh Long
|
||||||
* @see EnableMongoRepositories
|
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnClass({ Mongo.class, MongoTemplate.class })
|
@ConditionalOnClass({ Mongo.class, MongoTemplate.class })
|
||||||
|
|
@ -11,7 +11,6 @@ org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\
|
org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.data.JpaRepositoriesAutoConfiguration,\
|
org.springframework.boot.autoconfigure.data.JpaRepositoriesAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.data.MongoRepositoriesAutoConfiguration,\
|
org.springframework.boot.autoconfigure.data.MongoRepositoriesAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.data.MongoTemplateAutoConfiguration,\
|
|
||||||
org.springframework.boot.autoconfigure.redis.RedisAutoConfiguration,\
|
org.springframework.boot.autoconfigure.redis.RedisAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
|
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\
|
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\
|
||||||
|
|
@ -19,6 +18,7 @@ org.springframework.boot.autoconfigure.jms.JmsTemplateAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\
|
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.mobile.DeviceResolverAutoConfiguration,\
|
org.springframework.boot.autoconfigure.mobile.DeviceResolverAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\
|
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\
|
||||||
|
org.springframework.boot.autoconfigure.mongo.MongoTemplateAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\
|
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration,\
|
org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration,\
|
||||||
org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration,\
|
org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration,\
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import org.springframework.boot.autoconfigure.data.alt.CityMongoDbRepository;
|
||||||
import org.springframework.boot.autoconfigure.data.mongo.City;
|
import org.springframework.boot.autoconfigure.data.mongo.City;
|
||||||
import org.springframework.boot.autoconfigure.data.mongo.CityRepository;
|
import org.springframework.boot.autoconfigure.data.mongo.CityRepository;
|
||||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.mongo.MongoTemplateAutoConfiguration;
|
||||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012-2013 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 org.springframework.boot.autoconfigure.mongo;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Dave Syer
|
||||||
|
*/
|
||||||
|
public class MongoAutoConfigurationTests {
|
||||||
|
|
||||||
|
private AnnotationConfigApplicationContext context;
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void close() {
|
||||||
|
if (this.context != null) {
|
||||||
|
this.context.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void templateExists() {
|
||||||
|
this.context = new AnnotationConfigApplicationContext(
|
||||||
|
PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
|
||||||
|
MongoTemplateAutoConfiguration.class);
|
||||||
|
assertEquals(1, this.context.getBeanNamesForType(MongoTemplate.class).length);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue