2021年12月14日

SpringBoot - 环境切换与加载配置文件顺序

摘要: 大部分情况下,我们开发的产品应用都会根据不同的目的,支持运行在不同的环境(Profile)下,比如: 开发环境(dev),测试环境(test),预览环境(pre),生产环境(prod) 存在多个环境时动态的切换环境: application.yaml spring: profiles: active 阅读全文

posted @ 2021-12-14 20:33 每天积极向上 阅读(172) 评论(0) 推荐(0) 编辑

SpringBoot - 整合Mybatis

摘要: 导入依赖 pom.xml <!--开启SpringBoot jdbc--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dep 阅读全文

posted @ 2021-12-14 16:55 每天积极向上 阅读(122) 评论(0) 推荐(0) 编辑

SpringBoot - 整合默认Jdbc与Druid

摘要: 1.整合JDBC 导入依赖 pom.xml <!--开启SpringBootJdbc,默认为HikariDataSource源--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-st 阅读全文

posted @ 2021-12-14 16:48 每天积极向上 阅读(123) 评论(0) 推荐(0) 编辑

SpringBoot - 注入原生组件

摘要: Web原生组件注入(Servlet、Filter、Listener) @ServletComponentScan(basePackages = “com.atguigu.admin”):指定原生Servlet组件都放在那里@WebServlet(urlPatterns = “/my”):直接响应,没 阅读全文

posted @ 2021-12-14 15:36 每天积极向上 阅读(62) 评论(0) 推荐(0) 编辑

SpringBoot - 异常处理机制

摘要: 1.定制错误页面 一但系统出现4xx或者5xx之类的错误,就会来到/error请求 1.1 有模板引擎的情况下;error/状态码;** 【将错误页面命名为 错误状态码.html 放在模板引擎文件夹里面的 error文件夹下】,发生此状态码的错误就会来到 对应的页面; 我们可以使用4xx和5xx作为 阅读全文

posted @ 2021-12-14 15:22 每天积极向上 阅读(250) 评论(0) 推荐(0) 编辑

导航