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

移动门网站建设什么是网站制作app

移动门网站建设,什么是网站制作app,天津人工智能建站系统软件,郑州房地产网站目录 1. 使用Value和ConfigurationProperties2. 使用PropertySource创建Person.java写一个测试类 3. 使用ImportResourceStudent类创建beans.xml在主类中引入测试 其他心得 1. 使用Value和ConfigurationProperties 这里不加赘述了#xff0c;前面我也发过#xff0c;这里就放… 目录 1. 使用Value和ConfigurationProperties2. 使用PropertySource创建Person.java写一个测试类 3. 使用ImportResourceStudent类创建beans.xml在主类中引入测试 其他心得 1. 使用Value和ConfigurationProperties 这里不加赘述了前面我也发过这里就放个链接吧 Value获取值和ConfigurationProperties获取值用法及比较springboot 2. 使用PropertySource 创建Person.java package com.example.springbootdaily2.model;import org.springframework.format.annotation.DateTimeFormat;import java.util.Date; import java.util.List; import java.util.Map;Component PropertySource(value classpath:person.properties) // 这个是前缀的意思 ConfigurationProperties(prefix person2) public class PersonX {private String name;private Character sex;DateTimeFormat(pattern YYYY-MM-SS)private Date birthday;private Integer age;private String address;private MapString, Integer maps;private ListString lists;private Dog dog;public String getName() {return name;}public void setName(String name) {this.name name;}public Character getSex() {return sex;}public void setSex(Character sex) {this.sex sex;}public Date getBirthday() {return birthday;}public void setBirthday(Date birthday) {this.birthday birthday;}public String getAddress() {return address;}public void setAddress(String address) {this.address address;}public Dog getDog() {return dog;}public void setDog(Dog dog) {this.dog dog;}public Integer getAge() {return age;}public void setAge(Integer age) {this.age age;}public MapString, Integer getMaps() {return maps;}public void setMaps(MapString, Integer maps) {this.maps maps;}public ListString getLists() {return lists;}public void setLists(ListString lists) {this.lists lists;}Overridepublic String toString() {return Person{ name name \ , sex sex , birthday birthday , age age , address address \ , maps maps , lists lists , dog dog };} } 创建person.properties person2.name李四 person2.sex男 person2.birthday2022-02-07 person2.age18 person2.maps.keys116 person2.maps.keys216 person2.lists[12,24,57] person2.address保定廉耻 person2.dog.name${random.value}写一个测试类 package com.example.springbootdaily; import com.example.springbootdaily.model.Dog; import com.example.springbootdaily.model.Person; import com.example.springbootdaily.model.Person2; import com.example.springbootdaily.model.PersonX; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner;RunWith(SpringRunner.class) SpringBootTest public class SpringTest {AutowiredPersonX personX;Testpublic void print4(){System.out.println(personX);} } 输出结果 Person{name岳轩子, sexM, birthdaySun Dec 26 00:00:00 CST 2021, age18, address保定武汉, maps{keys216, keys116}, lists[[12, 24, 57]], dogDog{namecdab390f55c9f8a6bbb420cd15607add}}注如果显示乱码设置文件编码为utf-8 3. 使用ImportResource Student类 package com.example.springbootdaily.model;public class Student {private String name;private Integer age;public String getName() {return name;}public void setName(String name) {this.name name;}public Integer getAge() {return age;}public void setAge(Integer age) {this.age age;}Overridepublic String toString() {return Student{ name name \ , age age };} } 创建beans.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idstudent classcom.example.springbootdaily.model.Studentproperty namename value李四/property nameage value18//bean /beans在主类中引入 package com.example.springbootdaily;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ImportResource;SpringBootApplication ImportResource(locations classpath:beans.xml) public class SpringbootDailyApplication {public static void main(String[] args) {SpringApplication.run(SpringbootDailyApplication.class, args);}} 测试 package com.example.springbootdaily;import com.example.springbootdaily.model.*; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner;RunWith(SpringRunner.class) SpringBootTest public class SpringTest {AutowiredStudent student;Testpublic void print5(){System.out.println(student);} } 运行结果 Student{name李四, age18}其他 我们可以导入配置文件处理器以后编写配置就有提示了 !‐‐导入配置文件处理器配置文件进行绑定就会有提示‐‐ 依赖 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring‐boot‐configuration‐processor/artifactIdoptionaltrue/optional /dependency心得 平常还是要多多总结的。 谢谢大家支持
http://www.hkea.cn/news/14581637/

相关文章:

  • 哪里有免费建设网站合肥百度seo排名
  • 多个wordpress站点互相书签制作方法
  • 白银网站建设熊掌号英文版wordpress改中文
  • 成都网站建设cdajcxmip网站案例
  • wordpress网站如何提速量品定制和衣邦人哪个好
  • 潍坊网站建设优化排名建站市场分析
  • 企业网站建设外包临城网站
  • wordpress多语言配置文件网站免费优化工具
  • 做视频包的网站有哪些专门做ui图标的网站
  • 个人小型网站建设app开发公司资质
  • 卫生局网站建设阜宁住房和城乡建设局网站
  • 鹤山市住房和城乡建设局网站广东住房和城乡建设厅网站造价
  • 网站 建设文档企业网站有什么功能
  • 做网站是专业店面装修设计公司
  • 永康建设局网站微信扫码登记小程序
  • 为客户网站做产品描述建设个人网站第一步这么做
  • 企业网站策划怎么样建立网站有什么好处
  • 网站建设系统规划批量做网站
  • 彩钢做网站能赚钱吗公司网站建设是哪个部门的事情?
  • 沈阳高端网站制作公司上海鹭城建设集团网站
  • 广州机械网站开发商标交易
  • 个人网站建设模板简洁图片淘宝网页制作素材
  • 小米路由可以做网站吗免费外网加速器
  • 做视频网站都需要什么软件下载眉山网站开发
  • 网站申请了如何上传到服务器公司邮箱名称怎么取比较好
  • 网页模板素材网站网站建设与实现 文献综述
  • 女性时尚网站源码建设一个网站需要多久
  • php网站源码大全网页空间是什么意思
  • 可以做国外购物的网站有哪些西安有什么好玩的景点
  • 做网站手机端需要pc端的源代码吗ai免费模板网站