当前位置: 首页 > wzjs >正文

怎样做一个免费的网站ios微信上的pdf乱码

怎样做一个免费的网站,ios微信上的pdf乱码,做代金券的网站,wordpress的d8主题SpringBoot条件装配注解 Spring Boot 提供了一系列条件装配注解,用于控制 Bean 的创建和装配过程。以下是一些常用的条件装配注解及其详细介绍: ConditionalOnClass 作用:当类路径中存在指定的类时,才会创建该 Bean。 示例&#…

SpringBoot条件装配注解

Spring Boot 提供了一系列条件装配注解,用于控制 Bean 的创建和装配过程。以下是一些常用的条件装配注解及其详细介绍:
@ConditionalOnClass
作用:当类路径中存在指定的类时,才会创建该 Bean。
示例:

 @ConditionalOnClass(RedisTemplate.class)@Beanpublic SimpleCacheService<K, V> redisTemplateService(RedisTemplate<K, V> redisTemplate) {return new RedisCacheService<>(redisTemplate);}

说明:只有当类路径中存在 RedisTemplate 类时,才会创建 redisTemplateService Bean。

@ConditionalOnMissingClass
作用:当类路径中不存在指定的类时,才会创建该 Bean。
示例:

 @ConditionalOnMissingClass("org.springframework.data.redis.core.RedisTemplate")@Beanpublic SimpleCacheService<K, V> fallbackCacheService() {return new FallbackCacheService<>();}

说明:只有当类路径中不存在 RedisTemplate 类时,才会创建 fallbackCacheService Bean。

@ConditionalOnBean
作用:当容器中存在指定类型的 Bean 时,才会创建该 Bean。
示例:

 @ConditionalOnBean(RedisTemplate.class)@Beanpublic CacheManager cacheManager(RedisTemplate<K, V> redisTemplate) {return new RedisCacheManager(redisTemplate);}

说明:只有当容器中存在 RedisTemplate Bean 时,才会创建 cacheManager Bean。

@ConditionalOnMissingBean
作用:当容器中不存在指定类型的 Bean 时,才会创建该 Bean。
示例:

 @ConditionalOnMissingBean(SimpleCacheService.class)@Beanpublic SimpleCacheService<K, V> inMemoryCacheService() {return new InMemoryCacheService<>();}

说明:只有当容器中不存在 SimpleCacheService Bean 时,才会创建 inMemoryCacheService Bean。

@ConditionalOnProperty
作用:当配置文件中的某个属性满足特定条件时,才会创建该 Bean。
示例:

 @ConditionalOnProperty(name = "cache.type", havingValue = "redis")@Beanpublic SimpleCacheService<K, V> redisTemplateService(RedisTemplate<K, V> redisTemplate) {return new RedisCacheService<>(redisTemplate);}

说明:只有当配置文件中 cache.type 属性的值为 redis 时,才会创建 redisTemplateService Bean。

@ConditionalOnExpression
作用:当 SpEL 表达式的结果为 true 时,才会创建该 Bean。
示例:

 @ConditionalOnExpression("${cache.enabled:true}")@Beanpublic SimpleCacheService<K, V> cacheService() {return new DefaultCacheService<>();}

说明:只有当配置文件中的 cache.enabled 属性为 true 或未设置时,才会创建 cacheService Bean。

@ConditionalOnWebApplication@ConditionalOnNotWebApplication
作用:分别在 Web 应用程序和非 Web 应用程序中生效。
示例:

 @ConditionalOnWebApplication@Beanpublic WebService webService() {return new DefaultWebService();}@ConditionalOnNotWebApplication@Beanpublic NonWebService nonWebService() {return new DefaultNonWebService();}

这些注解可以帮助开发者根据不同的运行环境和配置条件来动态装配 Bean,提高应用的灵活性和可扩展性。

http://www.dtcms.com/wzjs/223441.html

相关文章:

  • 工信部网站icp备案号每日新闻播报
  • 山东建设发展研究院网站网店推广方法
  • 网站建设销售找客户话术ps培训
  • 网站建设延期合同书舆情分析报告案例
  • 慧生活798app下载网站 seo
  • 环艺毕业设计代做网站营销的方法和技巧
  • iis怎么让添加的网站没有端口朝阳seo排名优化培训
  • 做网站服务器配置怎么选交换友情链接是什么意思
  • wordpress首页调用文章多张图片高级seo是什么职位
  • 老外的网站怎么做怎么推广网址
  • 联盟平台济南专业seo推广公司
  • 企业网站建设 ppt什么是百度搜索推广
  • 兴扬汽车网站谁做的微信搜一搜seo
  • 厦门市城乡建设委员会网站深圳外贸网站建设
  • 网站生成app免费杭州网站建设网页制作
  • 网站建设与管理实践收获网络宣传渠道
  • 出国做博后关注哪些网站培训课
  • 江苏质监站网站做资料按效果付费的推广
  • 凤台做网站优化营商环境建议
  • 郑州网站建设最低价常州seo外包
  • 手机企业网站推广微信推广平台自己可以做
  • 网站页面模板 建设中推广电话
  • 物流公司网站建设seo在线优化排名
  • 广州建设信息网银徽seo
  • 树莓派做的网站重庆关键词排名首页
  • 机加工报价计算软件福州seo按天收费
  • 产品销售型的网站数据指数
  • 单页网站制作教程南宁今日头条最新消息
  • 临沂网站制作企业百度一下官网网址
  • 无锡做网站好seo按天计费系统