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

360网站建设服务大型做网站的公司有哪些

360网站建设服务,大型做网站的公司有哪些,长春高端网站制作,想学做网站学什么编程语言目录 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/14340948/

相关文章:

  • 高仿卡地亚手表网站做新闻微网站
  • 管网建设是什么意思青浦网站优化
  • 如何上传模板到网站网站建设中的风险
  • 小门户网站模版天津视频网站开发团队
  • 做网站需要多网站上做旅游卖家要学什么软件
  • 网站合作建设方案便宜点的网站空间
  • html5 手机 手机网站网站效果图可以做动态的嘛
  • 南昌网站建站企业网站开发实训过程与内容
  • 网站域名和服务器到期文字变形logo设计
  • 合肥专业做网站的公司有哪些apicloud影视源码
  • 怎么做网站监控平台wordpress登录后台不显示登录
  • 广州网站优化工具东莞网页制作招聘信息
  • wordpress早期版本上海网站优化公司排名
  • 做视频网站视频源wordpress 标签设置主页
  • 网站建设1000元创意旅行社wordpress
  • 佛山网站快速优化排名织梦技术个人网站模板
  • 网络程序开发深圳seo网络推广
  • 保险公司官方网站怎样自己制作网站做情感顾问
  • 网站留言系统是怎么做的怎么做网站的登录界面
  • 辽宁网站开发适合做手机主页的网站
  • 建网站免费工图网
  • 怎么自己开个免费网站四川建筑职业技术学院就业网
  • 有哪些竞价网站crm和erp的区别
  • 怎么兼职做网站音乐在线制作网站
  • 个人接外包的网站上饶建网站公司
  • 公司erp系统seo怎么搞
  • 地产网站模板python官网下载安装
  • 小说网站建设的支柱青岛网站设计建议i青岛博采
  • 怎样设计一个公司网站济南做网站建设公司
  • 青海设计网站北京贸易公司网站制作