本文整理匯總了Java中org.springframework.context.ApplicationContext.getBeanNamesForType方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationContext.getBeanNamesForType方法的具體用法?Java ApplicationContext.getBeanNamesForType怎麽用?Java ApplicationContext.getBeanNamesForType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.context.ApplicationContext
的用法示例。
在下文中一共展示了ApplicationContext.getBeanNamesForType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseCacheDuration
import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
private void parseCacheDuration(ApplicationContext applicationContext) {
final Map<String, Long> cacheExpires = new HashMap<>();
String[] beanNames = applicationContext.getBeanNamesForType(Object.class);
for (String beanName : beanNames) {
final Class clazz = applicationContext.getType(beanName);
addCacheExpires(clazz, cacheExpires);
}
//設置有效期
super.setExpires(cacheExpires);
}
示例2: countBeans
import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
private int countBeans(ApplicationContext context, Class<?> type) {
return context.getBeanNamesForType(type).length;
}
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:4,代碼來源:OAuth2AutoConfigurationTests.java
示例3: parseCacheDuration
import org.springframework.context.ApplicationContext; //導入方法依賴的package包/類
private void parseCacheDuration(ApplicationContext applicationContext) {
final Map<String, Long> cacheExpires = new HashMap<>();
String[] beanNames = applicationContext.getBeanNamesForType(Object.class);
for (String beanName : beanNames) {
final Class clazz = applicationContext.getType(beanName);
Service service = findAnnotation(clazz, Service.class);
if (null == service) {
continue;
}
addCacheExpires(clazz, cacheExpires);
}
logger.debug("初始化redisCacheManager, 配置有過期時間的key, 內容如下:" + cacheExpires);
//設置有效期
super.setExpires(cacheExpires);
}