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


Java UserCredentials类代码示例

本文整理汇总了Java中org.springframework.data.authentication.UserCredentials的典型用法代码示例。如果您正苦于以下问题:Java UserCredentials类的具体用法?Java UserCredentials怎么用?Java UserCredentials使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserCredentials类属于org.springframework.data.authentication包,在下文中一共展示了UserCredentials类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDb

import org.springframework.data.authentication.UserCredentials; //导入依赖的package包/类
@Override
public DB getDb(String dbName) throws DataAccessException {
    Assert.hasText(dbName, "Database name must not be empty.");
    MongoClientURI mongoURI = determineTargetDataSource();

    return MongoDbUtils.getDB(getMongo(mongoURI), dbName, new UserCredentials(mongoURI.getUsername(), parseChars(mongoURI.getPassword())), mongoURI.getDatabase());
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:8,代码来源:DynamicMongoConnection.java

示例2: createMongoTemplate

import org.springframework.data.authentication.UserCredentials; //导入依赖的package包/类
@Bean(name = "mongoTemplate")
public MongoTemplate createMongoTemplate() throws UnknownHostException {
    MongoClient mongoClient = new MongoClient(host, port);
    //TODO Configure additional MongoDB mongoClient settings if needed
    MongoDbFactory factory = new SimpleMongoDbFactory(mongoClient, database, new UserCredentials(username, password));
    MappingMongoConverter converter = new MappingMongoConverter(new DefaultDbRefResolver(factory), new MongoMappingContext());
    converter.setTypeMapper(new DefaultMongoTypeMapper(null));

    return new MongoTemplate(factory, converter);
}
 
开发者ID:mkopylec,项目名称:allegro-intellij-templates,代码行数:11,代码来源:$ Spring Data MongoDB Setup.java

示例3: mongoTemplate

import org.springframework.data.authentication.UserCredentials; //导入依赖的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

示例4: getUserCredentials

import org.springframework.data.authentication.UserCredentials; //导入依赖的package包/类
public UserCredentials getUserCredentials() {
    if (StringUtils.hasLength(dbUser)) {
        return new UserCredentials(dbUser, dbPassword);
    } else {
        return null;
    }
}
 
开发者ID:parekhparth,项目名称:SimpleJavaWS,代码行数:8,代码来源:MongoConfiguration.java

示例5: mongoDbFactory

import org.springframework.data.authentication.UserCredentials; //导入依赖的package包/类
public @Bean MongoDbFactory mongoDbFactory() throws MongoException, UnknownHostException {
	UserCredentials userCredentials = new UserCredentials(USER, PASSWORD);
	//return new SimpleMongoDbFactory(new MongoURI("mongodb://<user>:<pass>@<url>"));
	return new SimpleMongoDbFactory(new MongoClient(HOST,PORT), DATABASE, userCredentials);
}
 
开发者ID:digvijaybhakuni,项目名称:WebServiceProj,代码行数:6,代码来源:MongoDbConfig.java

示例6: mongoDbFactory

import org.springframework.data.authentication.UserCredentials; //导入依赖的package包/类
@Bean
public MongoDbFactory mongoDbFactory() throws Exception {
	return new SimpleMongoDbFactory(mongo, dbname, new UserCredentials(username, password));
}
 
开发者ID:jeffsegal,项目名称:mongo-rest,代码行数:5,代码来源:MongoConfig.java

示例7: mongoDbFactory

import org.springframework.data.authentication.UserCredentials; //导入依赖的package包/类
@Bean
public MongoDbFactory mongoDbFactory() throws Exception {
	UserCredentials userCredentials = new UserCredentials(env.getProperty("dbUser"), env.getProperty("dbPassword"));
	return new SimpleMongoDbFactory(new Mongo(mongoURI()), "pubanywhere", userCredentials);
}
 
开发者ID:thiagoandrade6,项目名称:pubanywhere,代码行数:6,代码来源:MongoConfig.java

示例8: mongoDbFactory

import org.springframework.data.authentication.UserCredentials; //导入依赖的package包/类
@Override
public SimpleMongoDbFactory mongoDbFactory() throws Exception {
    UserCredentials userCredentials = new UserCredentials(user, password);
    return new SimpleMongoDbFactory(mongo(), getDatabaseName(), userCredentials);
}
 
开发者ID:dtitov,项目名称:crowly,代码行数:6,代码来源:PersistenceConfig.java


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