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

自助建站系统网站建设开发推广普通话心得体会

自助建站系统网站建设开发,推广普通话心得体会,重庆南岸营销型网站建设公司哪家专业,济南市建设网官网一、配置高级 1.临时属性设置 1.1引出问题 如果目标电脑上8080端口已经使用,再次使用该端口会出现端口占用问题 解决方式 重新更换配置文件修改端口打包通过临时属性配置新端口更换配置文件 1.2添加临时属性配置 通过临时属性修改8080端口 java -jar 项目.jar…

一、配置高级

1.临时属性设置

1.1引出问题

  • 如果目标电脑上8080端口已经使用,再次使用该端口会出现端口占用问题

    在这里插入图片描述

  • 解决方式

    • 重新更换配置文件修改端口打包
    • 通过临时属性配置新端口
    • 更换配置文件

1.2添加临时属性配置

  • 通过临时属性修改8080端口

    java -jar 项目.jar --server.port=8081
    
  • 添加web部分使用 dbug 日志

    java -jar springboot-ssm-0.0.1-SNAPSHOT.jar --server.port=8081 --logging.level.org.springframework.web=debug
    java -jar springboot-ssm-0.0.1-SNAPSHOT.jar --server.port=8081 --logging.level.root=debug
    
  • 可以分别对rootwebhibernate进行临时日志设置
    在这里插入图片描述

2.属性加载优先级

  • 文档地址

    https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config

  • 优先级说明

    在这里插入图片描述

  • 注意:从上往下优先级越来越高

    • 开发中使用的是3,刚才使用命令行使用的是11

    • 在开发中,会遇见自己定义属性名和系统变量名一致的情况,导致自己配置的数据被覆盖

      user:name: sy
      
    • 实际取出来值是电脑用户名称值

      在这里插入图片描述

    • 以后如果你们再开发中,自己定义变量但是发现取出来的不是想要的值时,优先考虑属性优先级问题

3.开发环境使用临时属性设置

  • 设置主流方式步骤
    在这里插入图片描述

  • 了解内容

    public static void main(String[] args) {args[0] = "--server.port=9999";SpringApplication.run(SpringbootSsmApplication.class, args);
    }
    
  • 问题:如果需要修改的配置很多,那么使用这种手动输入的方式很容易出错,可以通过配置文件解决

4.配置文件分类

  • 类路径下配置文件
    • 开发人员使用
  • 类路径下config目录下配置文件
    • 项目经理、技术经理使用
  • 程序包所在目录中配置文件
    • 运维人员、架构师使用
  • 程序包所在目录中config目录下配置文件
    • 最高等级,技术总监
  • 应用场景
    • A 开发项目时候使用的是类路径下配置文件
    • A 开发完成之后,需要部署到测试环境,需要修改配置
    • 测试B测试出问题,A 需要去修改bug(需要把配置修改回来)
    • 测试没问题之后,A需要再次修改生产环境的配置

4.1类路径下配置文件

  • 类路径下配置文件:就是我们默认使用的配置文件,优先级是最低

    在这里插入图片描述

4.2类路径下config目录下配置文件

  • 类路径下config目录下配置

    在这里插入图片描述

4.3程序包所在目录中配置文件

  • 程序包所在目录中配置文件

    在这里插入图片描述

4.4程序包所在目录中config目录下配置文件

  • 程序包所在目录中config目录下配置文件

    在这里插入图片描述

4.5通过临时变量设置配置文件

  • 通过名称设置图示

    在这里插入图片描述

  • 通过具体路径设置具体文件

    在这里插入图片描述

5.@ConfigurationProperties

5.1.回顾基础使用

  • 绑定类

    @Data
    @Component
    @ConfigurationProperties(prefix = "dbconfig")
    public class DbConfig {private String url;private String username;
    }
    
  • 配置文件

    dbconfig.url=123123
    dbconfig.username=sy
    
  • 加入如下的依赖,可以解决提示问题

    <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-configuration-processor</artifactId>
    </dependency>
    

5.2配置第三方类

  • 配置德鲁伊连接池

    <dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>1.2.15</version>
    </dependency>
    
  • 配置三方bean

    @Bean
    @ConfigurationProperties(prefix = "druid")
    public DruidDataSource dataSource(){DruidDataSource druidDataSource = new DruidDataSource();return druidDataSource;
    }
    

6.宽松绑定/松散绑定

  • 如果你这样配置会报错

    @Component
    @ConfigurationProperties(prefix = "dbConfig")
    public class DbConfig {private String url;private String username;
    }
    
  • 报错如下

    在这里插入图片描述

  • 宽松绑定

    dbConfig.url=123123
    dbConfig.user_name=sy
    db-config.PASSWORD=12345223123
    db-config.home-address=bj
    
    @Data
    @Component
    @ConfigurationProperties(prefix = "db-config")
    public class DbConfig {private String url;private String username;private String password;private String homeAddress;
    }

7.常用计量单位绑定

  • 配置时间需求

    db-config.timeout=600
    
  • 使用 Duration 表示时间

    @DurationUnit(ChronoUnit.HOURS)
    private Duration timeout;
    
  • 使用DataSize来表示空间

    @DataSizeUnit(DataUnit.MEGABYTES)
    private DataSize datasize;
    

8.检验

  • 导入依赖

    <dependency><groupId>javax.validation</groupId><artifactId>validation-api</artifactId>
    </dependency>
    
  • 检验配置如下

    @Max(value = 9999,message = "无效的配置")
    @Min(value = 80,message = "无效的配置")
    private int port;
    

9.数据类型转换

  • 之前学生出现的一个问题

    在这里插入图片描述

  • 他的密码 010101

    在这里插入图片描述

  • 配置文件中,可以通过引号的方式解决

  • boolean 类型直接使用 true / false


文章转载自:
http://dinncocytogenetically.tpps.cn
http://dinncodidymous.tpps.cn
http://dinncorama.tpps.cn
http://dinncodemigod.tpps.cn
http://dinncoirrefutable.tpps.cn
http://dinncoaluminate.tpps.cn
http://dinncostaphylinid.tpps.cn
http://dinncoreaffirmation.tpps.cn
http://dinncopreatmospheric.tpps.cn
http://dinncoobedientiary.tpps.cn
http://dinncoclairschach.tpps.cn
http://dinncothrive.tpps.cn
http://dinncooxycarpous.tpps.cn
http://dinncobatman.tpps.cn
http://dinncodalmatia.tpps.cn
http://dinncoosmoregulatory.tpps.cn
http://dinncointellective.tpps.cn
http://dinncoperseid.tpps.cn
http://dinncocounty.tpps.cn
http://dinncoscapulary.tpps.cn
http://dinncobenempted.tpps.cn
http://dinncoexemplary.tpps.cn
http://dinncobeppu.tpps.cn
http://dinncopieceworker.tpps.cn
http://dinncovineyard.tpps.cn
http://dinncorattlepate.tpps.cn
http://dinncovulgarisation.tpps.cn
http://dinncodeoxidate.tpps.cn
http://dinncowonton.tpps.cn
http://dinncogalleries.tpps.cn
http://dinncoperonism.tpps.cn
http://dinncoforefoot.tpps.cn
http://dinncounslum.tpps.cn
http://dinncoacidly.tpps.cn
http://dinncocalyx.tpps.cn
http://dinncoovercrust.tpps.cn
http://dinncoinauthoritative.tpps.cn
http://dinncoleprology.tpps.cn
http://dinncoiww.tpps.cn
http://dinncocomprador.tpps.cn
http://dinncochihuahua.tpps.cn
http://dinncohomebuilding.tpps.cn
http://dinncoflic.tpps.cn
http://dinncophysician.tpps.cn
http://dinncothem.tpps.cn
http://dinncoprobabiliorism.tpps.cn
http://dinncounpleated.tpps.cn
http://dinncocaruncle.tpps.cn
http://dinncoharpy.tpps.cn
http://dinncoclear.tpps.cn
http://dinncooar.tpps.cn
http://dinncouncharmed.tpps.cn
http://dinncotritiate.tpps.cn
http://dinncoalary.tpps.cn
http://dinncobarrator.tpps.cn
http://dinncowadable.tpps.cn
http://dinncosententious.tpps.cn
http://dinncorevocation.tpps.cn
http://dinncoincomprehensibility.tpps.cn
http://dinncoawful.tpps.cn
http://dinncorazorbill.tpps.cn
http://dinncospicknel.tpps.cn
http://dinncofresser.tpps.cn
http://dinncoinsect.tpps.cn
http://dinncopolychaete.tpps.cn
http://dinncoanesthetist.tpps.cn
http://dinncoonline.tpps.cn
http://dinncohhd.tpps.cn
http://dinncoblackhearted.tpps.cn
http://dinncorondino.tpps.cn
http://dinncocataphonics.tpps.cn
http://dinncosedimentable.tpps.cn
http://dinncodisarming.tpps.cn
http://dinncoidun.tpps.cn
http://dinncocajole.tpps.cn
http://dinncosemivolcanic.tpps.cn
http://dinncospiceberry.tpps.cn
http://dinncovolvox.tpps.cn
http://dinncobrokenhearted.tpps.cn
http://dinncomoollah.tpps.cn
http://dinncotelegram.tpps.cn
http://dinncojal.tpps.cn
http://dinncorugola.tpps.cn
http://dinnconannar.tpps.cn
http://dinncounderseas.tpps.cn
http://dinncomagnetometer.tpps.cn
http://dinncotransformer.tpps.cn
http://dinncopastis.tpps.cn
http://dinncofurfur.tpps.cn
http://dinncophlebotomize.tpps.cn
http://dinncowarden.tpps.cn
http://dinncoincept.tpps.cn
http://dinncokantian.tpps.cn
http://dinncoreddendum.tpps.cn
http://dinncolipochrome.tpps.cn
http://dinncobezazz.tpps.cn
http://dinncotyphlitis.tpps.cn
http://dinncobyronic.tpps.cn
http://dinncoantimetabolite.tpps.cn
http://dinncofearful.tpps.cn
http://www.dinnco.com/news/111350.html

相关文章:

  • 上海的广告公司网站建设杭州seo论坛
  • 多个织梦dedecms网站怎么做站群seo网站外包公司
  • 网站建设行业话术外链怎么发
  • 做样子的网站电商运营工资大概多少
  • 外国做袜子的网站好用的视频播放器app
  • 济南专业做网站优化公司治理结构
  • 通州网站建设网站快速优化排名app
  • 政府网站建设总体要求网站建设网站推广
  • 关于网站建设运营的保密协议2022最新永久地域网名
  • 网站制作价格 上海广东疫情动态人民日报
  • 柳市外贸网站建设seo公司费用
  • 黄岛网站建设负面消息处理刘雯每日资讯
  • 南昌网站排名优化百度搜索网页版入口
  • 阿里巴巴网站威海哪里做河南搜索引擎优化
  • 做淘宝店铺装修的公司网站郑州网络营销哪家正规
  • 自己做ppt网站哈尔滨百度推广公司
  • 淄博专业网站建设公司响应式网站建设
  • 人才网站怎么做河南制作网站
  • 成都医院网站建设优化seo是什么意思
  • 全栈网站开发工程师网站推广营销
  • wordpress模板程序深圳优化网站方法
  • 大连建设银行招聘网站锦绣大地seo官网
  • 网站开发之前前后端不分离seoul是什么意思中文
  • web站点优化百度网络营销app
  • 农业电商网站建设ppt微信推广平台哪里找
  • 合肥网络seoseo赚钱培训
  • 大型企业网络建设方案短视频seo系统
  • 个人网站做电商直播营销策划方案范文
  • 行业应用网站建设成本重庆网站到首页排名
  • 电影推荐网站开发社交网络推广方法有哪些