本文整理汇总了Java中org.springframework.boot.autoconfigure.mongo.MongoProperties类的典型用法代码示例。如果您正苦于以下问题:Java MongoProperties类的具体用法?Java MongoProperties怎么用?Java MongoProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MongoProperties类属于org.springframework.boot.autoconfigure.mongo包,在下文中一共展示了MongoProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runner
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
@Bean
public CommandLineRunner runner(GitterProperties props, MongoProperties mongoProperties) {
return args -> {
context.registerBean(Mate.class, () -> new Mate("Lithium", "Alex", true));
Mate mate = context.getBean(Mate.class);
System.out.println("Mate from context: " + mate.nickname);
System.out.println("Gitter Room: " + props.getRoom());
Flux<Mate> people = Flux.just(
new Mate("aliaksei-lithium", "Aliaksei"),
new Mate("IRus", "Ruslan"),
new Mate("bsiamionau", "Bahdan")
);
repository.deleteAll().thenMany(repository.save(people)).blockLast();
};
}
示例2: MongoInstance
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public MongoInstance() throws IOException, InterruptedException {
// Download Mongo artifacts into the project directory to ease cleanup
IDownloadConfig downloadConfig = new DownloadConfigBuilder()
.defaultsForCommand(Command.MongoD)
.artifactStorePath(ARTIFACT_STORE_PATH)
.build();
// Extract Mongo artifacts into the project directory to ease cleanup
IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder()
.defaults(Command.MongoD)
.artifactStore(new ExtractedArtifactStoreBuilder()
.defaults(Command.MongoD)
.download(downloadConfig)
.extractDir(EXTRACTED_STORE_PATH)
)
.build();
// Store Mongo data into the project directory to ease cleanup
Storage replication = new Storage("./data/mongodb/data", null, 0);
MongodStarter starter = MongodStarter.getInstance(runtimeConfig);
IMongodConfig mongodConfig = new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.cmdOptions(new MongoCmdOptionsBuilder()
.useNoJournal(false)
.useSmallFiles(true)
.build())
.net(new Net(MongoProperties.DEFAULT_PORT, Network.localhostIsIPv6()))
.replication(replication)
.build();
mongo = starter.prepare(mongodConfig);
process = mongo.start();
}
示例3: EmbeddedMongoAutoConfiguration
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public EmbeddedMongoAutoConfiguration(MongoProperties properties,
EmbeddedMongoProperties embeddedProperties, ApplicationContext context,
IRuntimeConfig runtimeConfig) {
this.properties = properties;
this.embeddedProperties = embeddedProperties;
this.context = context;
this.runtimeConfig = runtimeConfig;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:EmbeddedMongoAutoConfiguration.java
示例4: MongoDbConfiguration
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
/**
* Constructor from {@link MongoAutoConfiguration}.
*/
@Autowired
public MongoDbConfiguration(MongoProperties properties,
ObjectProvider<MongoClientOptions> options, Environment environment) {
this.mongoProperties = properties;
this.options = options.getIfAvailable();
this.environment = environment;
}
示例5: copyMissingProperties
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
private void copyMissingProperties(MongoProperties mongoProperties, MongeezProperties mongeezProperties) {
if (StringUtils.isEmpty(mongeezProperties.getDatabase())) {
mongeezProperties.setDatabase(mongoProperties.getMongoClientDatabase());
}
if (StringUtils.isEmpty(mongeezProperties.getAuthenticationDatabase())) {
mongeezProperties.setAuthenticationDatabase(mongoProperties.getAuthenticationDatabase());
}
if (!mongeezProperties.hasCredentials() && hasCredentials(mongoProperties)) {
// cannot copy credentials because Spring Data MongoDB clears the password after using it
String msg = "Found credentials for Spring Data MongoDB but no credentials for Mongeez. " +
"You need to define both for authentication to work.";
throw new BeanCreationException(msg);
}
}
示例6: mongoTemplate
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
@Bean
@ConditionalOnProperty(value = APPLICATION_DATA_TYPE, havingValue = APPLICATION_DATA_TYPE_MONGO)
@Autowired
public MongoTemplate mongoTemplate(MongoProperties properties,
@Value("${spring.data.mongodb.password}") String password) throws Exception {
MongoClient client = new MongoClient(new ServerAddress(
properties.getHost(), properties.getPort()));
MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(client, properties.getDatabase(),
new UserCredentials(properties.getUsername(), password));
return new MongoTemplate(mongoDbFactory);
}
示例7: MongoConfiguration
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
@Autowired
public MongoConfiguration(MongoProperties mongoProperties) {
this.mongoProperties = mongoProperties;
}
示例8: getNaive
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public MongoProperties getNaive() {
return naive;
}
示例9: setNaive
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public void setNaive(MongoProperties naive) {
this.naive = naive;
}
示例10: getComplete
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public MongoProperties getComplete() {
return complete;
}
示例11: setComplete
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public void setComplete(MongoProperties complete) {
this.complete = complete;
}
示例12: getPort
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
private int getPort() {
if (this.properties.getPort() == null) {
return MongoProperties.DEFAULT_PORT;
}
return this.properties.getPort();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:EmbeddedMongoAutoConfiguration.java
示例13: MongoDataAutoConfiguration
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public MongoDataAutoConfiguration(ApplicationContext applicationContext,
MongoProperties properties) {
this.applicationContext = applicationContext;
this.properties = properties;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:MongoDataAutoConfiguration.java
示例14: GridFsMongoDbFactory
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
GridFsMongoDbFactory(MongoDbFactory mongoDbFactory, MongoProperties properties) {
Assert.notNull(mongoDbFactory, "MongoDbFactory must not be null");
Assert.notNull(properties, "Properties must not be null");
this.mongoDbFactory = mongoDbFactory;
this.properties = properties;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:MongoDataAutoConfiguration.java
示例15: MongoDataAutoConfiguration
import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public MongoDataAutoConfiguration(MongoProperties properties, Environment environment,
ResourceLoader resourceLoader) {
this.properties = properties;
this.environment = environment;
this.resourceLoader = resourceLoader;
}