当前位置: 首页>>代码示例>>Java>>正文


Java MongoProperties类代码示例

本文整理汇总了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();
    };
}
 
开发者ID:aliaksei-lithium,项目名称:spring5demo,代码行数:17,代码来源:Spring5demoApplication.java

示例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();
    }
 
开发者ID:mike-plummer,项目名称:graylog-springboot,代码行数:37,代码来源:MongoInstance.java

示例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;
}
 
开发者ID:dzhw,项目名称:metadatamanagement,代码行数:11,代码来源:MongoDbConfiguration.java

示例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);
    }
}
 
开发者ID:hzpz,项目名称:mongeez-spring-boot-starter,代码行数:15,代码来源:MongeezAutoConfiguration.java

示例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);
}
 
开发者ID:yo1000,项目名称:bluefairy,代码行数:14,代码来源:ApplicationContext.java

示例7: MongoConfiguration

import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
@Autowired
public MongoConfiguration(MongoProperties mongoProperties) {
    this.mongoProperties = mongoProperties;
}
 
开发者ID:aliaksei-lithium,项目名称:spring5demo,代码行数:5,代码来源:MongoConfiguration.java

示例8: getNaive

import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public MongoProperties getNaive() {
    return naive;
}
 
开发者ID:zhangtr,项目名称:canal-mongo,代码行数:4,代码来源:MultipleMongoProperties.java

示例9: setNaive

import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public void setNaive(MongoProperties naive) {
    this.naive = naive;
}
 
开发者ID:zhangtr,项目名称:canal-mongo,代码行数:4,代码来源:MultipleMongoProperties.java

示例10: getComplete

import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public MongoProperties getComplete() {
    return complete;
}
 
开发者ID:zhangtr,项目名称:canal-mongo,代码行数:4,代码来源:MultipleMongoProperties.java

示例11: setComplete

import org.springframework.boot.autoconfigure.mongo.MongoProperties; //导入依赖的package包/类
public void setComplete(MongoProperties complete) {
    this.complete = complete;
}
 
开发者ID:zhangtr,项目名称:canal-mongo,代码行数:4,代码来源:MultipleMongoProperties.java

示例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;
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:7,代码来源:MongoDataAutoConfiguration.java


注:本文中的org.springframework.boot.autoconfigure.mongo.MongoProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。