本文整理汇总了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);
}