當前位置: 首頁>>代碼示例>>Java>>正文


Java MongoOperationsSessionRepository類代碼示例

本文整理匯總了Java中org.springframework.session.data.mongo.MongoOperationsSessionRepository的典型用法代碼示例。如果您正苦於以下問題:Java MongoOperationsSessionRepository類的具體用法?Java MongoOperationsSessionRepository怎麽用?Java MongoOperationsSessionRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MongoOperationsSessionRepository類屬於org.springframework.session.data.mongo包,在下文中一共展示了MongoOperationsSessionRepository類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mongoSessionRepository

import org.springframework.session.data.mongo.MongoOperationsSessionRepository; //導入依賴的package包/類
@Bean
public MongoOperationsSessionRepository mongoSessionRepository(MongoOperations mongoOperations) {

	MongoOperationsSessionRepository repository = new MongoOperationsSessionRepository(mongoOperations);
	repository.setMaxInactiveIntervalInSeconds(this.maxInactiveIntervalInSeconds);

	if (this.mongoSessionConverter != null) {
		repository.setMongoSessionConverter(this.mongoSessionConverter);
	}

	if (StringUtils.hasText(this.collectionName)) {
		repository.setCollectionName(this.collectionName);
	}

	return repository;
}
 
開發者ID:spring-projects,項目名稱:spring-session-data-mongodb,代碼行數:17,代碼來源:MongoHttpSessionConfiguration.java

示例2: defaultConfiguration

import org.springframework.session.data.mongo.MongoOperationsSessionRepository; //導入依賴的package包/類
@Test
public void defaultConfiguration() {

	registerAndRefresh(DefaultConfiguration.class);

	assertThat(this.context.getBean(MongoOperationsSessionRepository.class))
		.isNotNull();
}
 
開發者ID:spring-projects,項目名稱:spring-session-data-mongodb,代碼行數:9,代碼來源:MongoHttpSessionConfigurationTest.java

示例3: customCollectionName

import org.springframework.session.data.mongo.MongoOperationsSessionRepository; //導入依賴的package包/類
@Test
public void customCollectionName() {

	registerAndRefresh(CustomCollectionNameConfiguration.class);

	MongoOperationsSessionRepository repository = this.context.getBean(MongoOperationsSessionRepository.class);

	assertThat(repository).isNotNull();
	assertThat(ReflectionTestUtils.getField(repository, "collectionName"))
		.isEqualTo(COLLECTION_NAME);
}
 
開發者ID:spring-projects,項目名稱:spring-session-data-mongodb,代碼行數:12,代碼來源:MongoHttpSessionConfigurationTest.java

示例4: customMaxInactiveIntervalInSeconds

import org.springframework.session.data.mongo.MongoOperationsSessionRepository; //導入依賴的package包/類
@Test
public void customMaxInactiveIntervalInSeconds() {

	registerAndRefresh(CustomMaxInactiveIntervalInSecondsConfiguration.class);

	MongoOperationsSessionRepository repository = this.context.getBean(MongoOperationsSessionRepository.class);

	assertThat(repository).isNotNull();
	assertThat(ReflectionTestUtils.getField(repository, "maxInactiveIntervalInSeconds"))
		.isEqualTo(MAX_INACTIVE_INTERVAL_IN_SECONDS);
}
 
開發者ID:spring-projects,項目名稱:spring-session-data-mongodb,代碼行數:12,代碼來源:MongoHttpSessionConfigurationTest.java

示例5: setCustomMaxInactiveIntervalInSeconds

import org.springframework.session.data.mongo.MongoOperationsSessionRepository; //導入依賴的package包/類
@Test
public void setCustomMaxInactiveIntervalInSeconds() {

	registerAndRefresh(CustomMaxInactiveIntervalInSecondsSetConfiguration.class);

	MongoOperationsSessionRepository repository = this.context.getBean(MongoOperationsSessionRepository.class);

	assertThat(repository).isNotNull();
	assertThat(ReflectionTestUtils.getField(repository, "maxInactiveIntervalInSeconds"))
			.isEqualTo(MAX_INACTIVE_INTERVAL_IN_SECONDS);
}
 
開發者ID:spring-projects,項目名稱:spring-session-data-mongodb,代碼行數:12,代碼來源:MongoHttpSessionConfigurationTest.java

示例6: setCustomSessionConverterConfiguration

import org.springframework.session.data.mongo.MongoOperationsSessionRepository; //導入依賴的package包/類
@Test
public void setCustomSessionConverterConfiguration() {

	registerAndRefresh(CustomSessionConverterConfiguration.class);

	MongoOperationsSessionRepository repository = this.context.getBean(MongoOperationsSessionRepository.class);
	AbstractMongoSessionConverter mongoSessionConverter = this.context.getBean(AbstractMongoSessionConverter.class);

	assertThat(repository).isNotNull();
	assertThat(mongoSessionConverter).isNotNull();
	assertThat(ReflectionTestUtils.getField(repository, "mongoSessionConverter"))
			.isEqualTo(mongoSessionConverter);
}
 
開發者ID:spring-projects,項目名稱:spring-session-data-mongodb,代碼行數:14,代碼來源:MongoHttpSessionConfigurationTest.java

示例7: mongoSessionStore

import org.springframework.session.data.mongo.MongoOperationsSessionRepository; //導入依賴的package包/類
@Test
public void mongoSessionStore() {
	load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
			MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
			"spring.session.store-type=mongo", "spring.data.mongodb.port=0");
	validateSessionRepository(MongoOperationsSessionRepository.class);
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:8,代碼來源:SessionAutoConfigurationTests.java

示例8: mongoSessionStoreWithCustomizations

import org.springframework.session.data.mongo.MongoOperationsSessionRepository; //導入依賴的package包/類
@Test
public void mongoSessionStoreWithCustomizations() {
	load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
			MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
			"spring.session.store-type=mongo", "spring.data.mongodb.port=0",
			"spring.session.mongo.collection-name=foobar");
	MongoOperationsSessionRepository repository = validateSessionRepository(
			MongoOperationsSessionRepository.class);
	assertThat(new DirectFieldAccessor(repository).getPropertyValue("collectionName"))
			.isEqualTo("foobar");
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:12,代碼來源:SessionAutoConfigurationTests.java


注:本文中的org.springframework.session.data.mongo.MongoOperationsSessionRepository類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。