上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 51 下一页
摘要: SpringBoot默认使用Tomcat作为嵌入式的Servlet容器 1、修改和server有关的配置(ServerProperties【也是EmbeddedServletContainerCustomizer】 2、编写一个EmbeddedServletContainerCustomizer:嵌 阅读全文
posted @ 2018-07-15 22:38 1161588342 阅读(310) 评论(0) 推荐(0)
摘要: 1)、如何定制错误的页面; ​ 1)、有模板引擎的情况下;error/状态码; 【将错误页面命名为 错误状态码.html 放在模板引擎文件夹里面的 error文件夹下】,发生此状态码的错误就会来到 对应的页面; ​ 我们可以使用4xx和5xx作为错误页面的文件名来匹配这种类型的所有错误,精确优先(优 阅读全文
posted @ 2018-07-15 22:07 1161588342 阅读(214) 评论(0) 推荐(0)
摘要: 请求方式时,若不存在 浏览器出现White label Error Page 错误页面 其他客户端出现响应一个JSON格式文本包含错误码等信息 浏览器发送请求的请求头: 客户端请求头 这样就能区分来自哪.. 原理:ErrorMvcAutoconfiguration 处理错误的自动配置 里面添加了以下 阅读全文
posted @ 2018-07-15 16:21 1161588342 阅读(156) 评论(0) 推荐(0)
摘要: 修改spring boot 默认日志的配置 #logging.path=# 不指定路径在当前项目下生成springboot.log日志# 可以指定完整的路径;#logging.file=G:/springboot.log # 在当前磁盘的根路径下创建spring文件夹和里面的log文件夹;使用 sp 阅读全文
posted @ 2018-07-14 23:15 1161588342 阅读(140) 评论(0) 推荐(0)
摘要: 1、自动配置原理: 1)、SpringBoot启动的时候加载主配置类,开启了自动配置功能 ==@EnableAutoConfiguration== 2)、@EnableAutoConfiguration 作用: 利用EnableAutoConfigurationImportSelector给容器中导 阅读全文
posted @ 2018-07-14 21:37 1161588342 阅读(242) 评论(0) 推荐(0)
摘要: springboot 启动会扫描以下位置的application.properties或者application.yml文件作为Spring boot的默认配置文件 –file:./config/ –file:./ –classpath:/config/ –classpath:/ 优先级由高到底,高 阅读全文
posted @ 2018-07-14 21:29 1161588342 阅读(277) 评论(0) 推荐(0)
摘要: 1、多Profile文件 我们在主配置文件编写的时候,文件名可以是 application-{profile}.properties/yml 默认使用application.properties的配置; 2、yml支持多文档块方式 3、激活指定profile ​ 1、在配置文件中指定 spring. 阅读全文
posted @ 2018-07-14 21:28 1161588342 阅读(162) 评论(0) 推荐(0)
摘要: 配置文件占位符 1:使用随机数 2: 占位符获取之前配置的值,如果没有可以是用:指定默认值 阅读全文
posted @ 2018-07-14 21:25 1161588342 阅读(279) 评论(0) 推荐(0)
摘要: @PropertySource:加载指定的配置文件 @ImportResource:导入Spring的配置文件,让配置文件里面的内容生效; Spring Boot里面没有Spring的配置文件,我们自己编写的配置文件,也不能自动识别; 想让Spring的配置文件生效,加载进来;@ImportReso 阅读全文
posted @ 2018-07-14 21:24 1161588342 阅读(292) 评论(0) 推荐(0)
摘要: 配置文件yml还是properties他们都能获取到值; 如果说,我们只是在某个业务逻辑中需要获取一下配置文件中的某项值,使用@Value; 如果说,我们专门编写了一个javaBean来和配置文件进行映射,我们就直接使用@ConfigurationProperties; 阅读全文
posted @ 2018-07-14 10:52 1161588342 阅读(131) 评论(0) 推荐(0)
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 51 下一页