Browse Source

Move MongoTemplateAutoConfiguration to mongo package

pull/590/head
Dave Syer 12 years ago
parent
commit
006d7b6931
  1. 1
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfiguration.java
  2. 5
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoTemplateAutoConfiguration.java
  3. 2
      spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories
  4. 1
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/MongoRepositoriesAutoConfigurationTests.java
  5. 49
      spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java

1
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfiguration.java

@ -60,4 +60,5 @@ public class MongoAutoConfiguration { @@ -60,4 +60,5 @@ public class MongoAutoConfiguration {
this.mongo = this.properties.createMongoClient();
return this.mongo;
}
}

5
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/MongoTemplateAutoConfiguration.java → spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoTemplateAutoConfiguration.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.data;
package org.springframework.boot.autoconfigure.mongo;
import java.net.UnknownHostException;
@ -22,11 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -22,11 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
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.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import com.mongodb.Mongo;
@ -43,7 +41,6 @@ import com.mongodb.Mongo; @@ -43,7 +41,6 @@ import com.mongodb.Mongo;
* @author Dave Syer
* @author Oliver Gierke
* @author Josh Long
* @see EnableMongoRepositories
*/
@Configuration
@ConditionalOnClass({ Mongo.class, MongoTemplate.class })

2
spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories

@ -11,7 +11,6 @@ org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration,\ @@ -11,7 +11,6 @@ org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration,\
org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\
org.springframework.boot.autoconfigure.data.JpaRepositoriesAutoConfiguration,\
org.springframework.boot.autoconfigure.data.MongoRepositoriesAutoConfiguration,\
org.springframework.boot.autoconfigure.data.MongoTemplateAutoConfiguration,\
org.springframework.boot.autoconfigure.redis.RedisAutoConfiguration,\
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\
@ -19,6 +18,7 @@ org.springframework.boot.autoconfigure.jms.JmsTemplateAutoConfiguration,\ @@ -19,6 +18,7 @@ org.springframework.boot.autoconfigure.jms.JmsTemplateAutoConfiguration,\
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\
org.springframework.boot.autoconfigure.mobile.DeviceResolverAutoConfiguration,\
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\
org.springframework.boot.autoconfigure.mongo.MongoTemplateAutoConfiguration,\
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\
org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration,\
org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration,\

1
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/MongoRepositoriesAutoConfigurationTests.java

@ -23,6 +23,7 @@ import org.springframework.boot.autoconfigure.data.alt.CityMongoDbRepository; @@ -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.CityRepository;
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.Configuration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

49
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfigurationTests.java

@ -0,0 +1,49 @@ @@ -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…
Cancel
Save