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

台东县网站建设_网站建设公司_支付系统_seo优化

青岛 网站设计,做预约的网站,专注合肥网站推广,动画片是怎么制作出来的首先新建一个springboot项目#xff0c;此处省略。 1.新建一个application.properties person.namekevin person.age6 person.sexmale 2.新建一个类#xff0c;自动读取对应字段的值 有两种方式#xff0c; 第一种 package cn.wq;import org.springframework.beans.factory.… 首先新建一个springboot项目此处省略。 1.新建一个application.properties person.namekevin person.age6 person.sexmale   2.新建一个类自动读取对应字段的值 有两种方式 第一种 package cn.wq;import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource;Configuration EnableConfigurationProperties PropertySource(classpath:application.properties) public class Person2Properties {Value(${person.name})private String name;Value(${person.age})private String age;Value(${person.sex})private String sex;public String getName() {return name;}public void setName(String name) {this.name name;}public String getAge() {return age;}public void setAge(String age) {this.age age;}public String getSex() {return sex;}public void setSex(String sex) {this.sex sex;} }   第二种 package cn.wq;import org.springframework.boot.context.properties.ConfigurationProperties;ConfigurationProperties(prefix person) /*如果使用prefix则属性名中不能使用Value来注解,但是必须在spring启动时添加注解 EnableConfigurationProperties(PersonProperties.class)*/ public class PersonProperties {private String name;private String age;private String sex;public String getName() {return name;}public void setName(String name) {this.name name;}public String getAge() {return age;}public void setAge(String age) {this.age age;}public String getSex() {return sex;}public void setSex(String sex) {this.sex sex;} }   3.启动主程序 package cn.wq;import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration;Configuration EnableConfigurationProperties(PersonProperties.class) SpringBootApplication public class Application2 implements CommandLineRunner {public static void main(String[] args){SpringApplication.run(Application2.class,args);}AutowiredPersonProperties personProperties;AutowiredPerson2Properties person2Properties;Overridepublic void run(String... args) {System.out.println(程序实际上的入口在这里。);System.out.println(name:personProperties.getName());System.out.println(age:personProperties.getAge());System.out.println(sex:personProperties.getSex());System.out.println(2-name:person2Properties.getName());System.out.println(2-age:person2Properties.getAge());System.out.println(2-sex:person2Properties.getSex());} }   4.运行输出结果 . ____ _ __ _ _/\\ / ____ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | _ | _| | _ \/ _ | \ \ \ \\\/ ___)| |_)| | | | | || (_| | ) ) ) ) |____| .__|_| |_|_| |_\__, | / / / /|_||___//_/_/_/:: Spring Boot :: (v2.1.0.RELEASE)2019-06-19 20:20:50.348 INFO 18344 --- [ main] cn.wq.Application2 : Starting Application2 on cnki5213 with PID 18344 (C:\AppConsoleSpringBoot\target\classes started by Administrator in C:\AppConsoleSpringBoot) 2019-06-19 20:20:50.354 INFO 18344 --- [ main] cn.wq.Application2 : No active profile set, falling back to default profiles: default 2019-06-19 20:20:51.303 INFO 18344 --- [ main] cn.wq.Application2 : Started Application2 in 1.564 seconds (JVM running for 3.74) 程序实际上的入口在这里。 name:kevin age:6 sex:male 2-name:kevin 2-age:6 2-sex:maleProcess finished with exit code 0   鸣谢 参考文献https://www.cnblogs.com/V1haoge/p/7183408.html  转载于:https://www.cnblogs.com/wangqiideal/p/11054439.html
http://www.lebaoying.cn/news/63342.html

相关文章:

  • 网站怎样做谷歌推广开发网站设计公司
  • 天津最好的网站建设公司wordpress仿简书主题
  • 企业网站源码 企业网站管理系统wordpress自动发帖
  • 做钓鱼网站视频教程建筑工程网站模板
  • 滨州做网站的科技公司asp.net开发网站和优势
  • 外贸有限公司英文网站有没有装修做团购的网站
  • 网站建设的技术标准我的网站怎么不能搜索
  • 网站改版设计注意事项做一个门户网站要多少钱
  • 做网站框架阳江招聘网兼职
  • 网站做好后怎么更新内容品牌注册查询系统
  • 上海人才引进网站湖南it网站建设mxtia
  • 企业网站营销策划合肥网站建设首选众龙
  • 长宁移动网站建设沈阳建设工程城乡建设厅
  • 网站购买域名吗外贸网站有哪些平台
  • 怎么把自己的网站推广网站策划搭建方案
  • 网站开发研究论文网店代运营店铺
  • iis做的网站提示500建设银行反钓鱼网站
  • 陕西省建设监理工程协会网站怎么直接做免费网站吗
  • 学网站开发工作好找吗凡科做网站好吗
  • 赣州大余做网站建设有哪几个平台做网站
  • 网站后台登陆不进去一个软件是怎么做出来的
  • sae 网站备案wordpress功能强大的主题
  • 网站怎么创建论坛网站建设外地便宜
  • 网站开发项目比赛自己制作一个网站怎么制作
  • 仿木鱼网络网站如何做一个网页界面
  • 做lgoo的网站一般有哪些印尼网站建设费用
  • 广州设计网站建设重庆地推团队外包
  • 阳江网站建设推广argo wordpress主题
  • 自己做的网站怎么发布wordpress传输失败
  • 网站备案到哪里成都专门做网站的公司