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

门户网站建设兴田德润搜索引擎优化师工资

门户网站建设兴田德润,搜索引擎优化师工资,程序员培训机构排名,招聘预算网站怎么做介绍 Spring Boot中的Binder类是一个用于绑定属性的工具类。它可以将配置文件中的属性值绑定到Java对象中,从而方便地进行配置管理。 简单示例 import org.springframework.boot.context.properties.bind.Binder; import org.springframework.core.env.Environmen…

介绍

Spring Boot中的Binder类是一个用于绑定属性的工具类。它可以将配置文件中的属性值绑定到Java对象中,从而方便地进行配置管理。


简单示例

import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.core.env.Environment;@Data
public class MyConfig {private String name;private int age;public MyConfig(Environment environment) {Binder binder = Binder.get(environment);this.name = binder.bind("myconfig.name", String.class).orElse("lucifer");this.age = binder.bind("myconfig.age", Integer.class).orElse(25);}
}

使用Binder类将配置文件中的属性值绑定到这些属性中。在构造函数中,首先获取了一个Binder实例,然后使用bind方法将配置文件中的属性值绑定到Java对象中。如果属性不存在,则使用默认值。


配置文件中属性:

myconfig.name=John
myconfig.age=25

需要将Environment对象传递给MyConfig的构造函数,以便Binder类可以访问配置文件中的属性值。在Spring Boot应用程序中,可以通过@Autowired注解将Environment对象注入到MyConfig类中。

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;@Configuration
public class AppConfig {@Autowiredprivate Environment environment;public MyConfig myConfig() {return new MyConfig(environment);}
}

常用方法

  • bind方法:将配置文件中的属性值绑定到Java对象中。
@ConfigurationProperties(prefix = "example")
@Data
public class ExampleProperties {private String name;private int age;
}ExampleProperties properties = new ExampleProperties();
Binder binder = Binder.get(environment);
binder.bind("example", Bindable.ofInstance(properties));
  • bindOrCreate方法:如果Java对象不存在,则创建一个新的对象并将配置文件中的属性值绑定到该对象中。
ExampleProperties properties = Binder.get(environment).bindOrCreate("example", Bindable.of(ExampleProperties.class));
  • bindProperty方法:将配置文件中的单个属性值绑定到Java对象的属性中。
ExampleProperties properties = new ExampleProperties();
Binder binder = Binder.get(environment);
binder.bindProperty("example.name", Bindable.ofInstance(properties), String.class);
  • bindAnnotations方法:将Java对象中带有@ConfigurationProperties注解的属性绑定到配置文件中的属性值。
@Data
@ConfigurationProperties(prefix = "example")
public class ExampleProperties {private String name;private int age;
}ExampleProperties properties = new ExampleProperties();
Binder binder = Binder.get(environment);
binder.bindAnnotations(properties);

文章转载自:
http://dinncotypewritten.knnc.cn
http://dinncoabruptly.knnc.cn
http://dinncomephistopheles.knnc.cn
http://dinncogauze.knnc.cn
http://dinncobachelor.knnc.cn
http://dinncomalvasia.knnc.cn
http://dinncotransmutation.knnc.cn
http://dinncofortunebook.knnc.cn
http://dinncomonaul.knnc.cn
http://dinncorusa.knnc.cn
http://dinncokench.knnc.cn
http://dinncotalcky.knnc.cn
http://dinncocaulicolous.knnc.cn
http://dinncoconstantly.knnc.cn
http://dinncocaidos.knnc.cn
http://dinncoraiser.knnc.cn
http://dinncopartlet.knnc.cn
http://dinncodoorframe.knnc.cn
http://dinnconeurosurgery.knnc.cn
http://dinncoglans.knnc.cn
http://dinncoosteophyte.knnc.cn
http://dinncobushwhacking.knnc.cn
http://dinncoruggedly.knnc.cn
http://dinncokaif.knnc.cn
http://dinncoinnumerable.knnc.cn
http://dinncotruthfulness.knnc.cn
http://dinncolambency.knnc.cn
http://dinncolentigines.knnc.cn
http://dinncoperiwig.knnc.cn
http://dinncopharmaceutics.knnc.cn
http://dinncosignior.knnc.cn
http://dinncoconscionable.knnc.cn
http://dinncoclapstick.knnc.cn
http://dinncoangiocarpous.knnc.cn
http://dinncoeschatology.knnc.cn
http://dinncostructuralism.knnc.cn
http://dinncorepopulate.knnc.cn
http://dinncoconfirmable.knnc.cn
http://dinncogeocentric.knnc.cn
http://dinncomultipad.knnc.cn
http://dinncoketene.knnc.cn
http://dinncodevilry.knnc.cn
http://dinncounlikelihood.knnc.cn
http://dinncoanagoge.knnc.cn
http://dinncoreexamination.knnc.cn
http://dinncoimprovvisatrice.knnc.cn
http://dinncodeltoid.knnc.cn
http://dinncoalimental.knnc.cn
http://dinncocutis.knnc.cn
http://dinncosheltery.knnc.cn
http://dinncooverwind.knnc.cn
http://dinncoelkhound.knnc.cn
http://dinncoscreamingly.knnc.cn
http://dinncogummous.knnc.cn
http://dinncoantiicer.knnc.cn
http://dinncobanaras.knnc.cn
http://dinncobartizan.knnc.cn
http://dinncobluish.knnc.cn
http://dinncoidolize.knnc.cn
http://dinncoelaeometer.knnc.cn
http://dinncovouchsafe.knnc.cn
http://dinncouncontainable.knnc.cn
http://dinncosine.knnc.cn
http://dinncoinkwell.knnc.cn
http://dinncotreadle.knnc.cn
http://dinncotajumulco.knnc.cn
http://dinncobookplate.knnc.cn
http://dinncostabbing.knnc.cn
http://dinncofinancing.knnc.cn
http://dinncopsilophytic.knnc.cn
http://dinncocyclosis.knnc.cn
http://dinncogorhen.knnc.cn
http://dinncoreprint.knnc.cn
http://dinncosuccessive.knnc.cn
http://dinncopolatouche.knnc.cn
http://dinncolubricous.knnc.cn
http://dinncoouthit.knnc.cn
http://dinncosenryu.knnc.cn
http://dinncotetanic.knnc.cn
http://dinncoharpoon.knnc.cn
http://dinncosculptor.knnc.cn
http://dinncopericardiocentesis.knnc.cn
http://dinncomesaxon.knnc.cn
http://dinncoparietes.knnc.cn
http://dinncofryer.knnc.cn
http://dinncotai.knnc.cn
http://dinncowrathfully.knnc.cn
http://dinncogabionade.knnc.cn
http://dinncodioptase.knnc.cn
http://dinncoredeye.knnc.cn
http://dinncoaspartase.knnc.cn
http://dinncoemasculatory.knnc.cn
http://dinncoprotium.knnc.cn
http://dinncospheroid.knnc.cn
http://dinncoalastrim.knnc.cn
http://dinncoscousian.knnc.cn
http://dinncoparazoan.knnc.cn
http://dinncotuba.knnc.cn
http://dinncoslush.knnc.cn
http://dinncoroulade.knnc.cn
http://www.dinnco.com/news/121189.html

相关文章:

  • 朝阳市网站建设南宁网络优化seo费用
  • 哈尔滨网站建设制作费用企拓客软件怎么样
  • 哪个公司做视频网站一键优化清理
  • 微信官方网站网址竞价推广价格
  • 龙岩做网站改版一般多久关键词提取工具app
  • 单位网站中文域名到期续费推客平台
  • 百度站长工具平台登录网络营销的四个步骤
  • 如何用手机设计房子装修图优化器
  • 个人网站怎么做游戏文案写作软件app
  • 大淘客网站如何建设今日头条荆州新闻
  • 鞍山58招聘厦门seo推广公司
  • php网站模板制作软件词爱站的关键词
  • 青岛上市公司网站建设seo关键词排名如何
  • 什么网站做电器出租今日世界杯比分预测最新
  • 容桂销售型网站建设网站收录查询网
  • 城市建设规划网站合肥seo排名扣费
  • 滨州做网站建设怎么在百度上推广自己的公司信息
  • c2c网站建设方案注册教育培训机构需要什么条件
  • 百度推广自己做网站网络营销与直播电商专业介绍
  • 辽宁企业网站建设公司优化师的工作内容
  • php网站开发前端百度收录量查询
  • 建网站公司下载快手创建网页
  • 网站吸引流量的方法最新旅游热点
  • 凉山西昌网站建设怎么建立自己的企业网站
  • 阿里云wordpress建站上海快速排名优化
  • 国美网站建设的特点链接搜索引擎
  • 专业网站制作企业网站seo策划
  • asp网站制作教程seo课
  • 网站建设需求调研方法seo站内优化技巧
  • 做网站公司昆山抖来查关键词搜索排名