摘要:
在pom.xml中导入mybatis依赖 <!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter --> <dependency> <groupId>org.mybatis
阅读全文
posted @ 2022-08-12 16:23
折木~
阅读(32)
推荐(0)
编辑
摘要:
在pom.xml中导入Druid <!-- https://mvnrepository.com/artifact/com.alibaba/druid --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifact
阅读全文
posted @ 2022-08-12 09:54
折木~
阅读(188)
推荐(0)
编辑
摘要:
编写配置文件(application.yml) spring: datasource: username: root password: 123456 url: jdbc:mysql://localhost:3306/mybatis?useUnicode&characterEncoding=utf-
阅读全文
posted @ 2022-08-11 22:54
折木~
阅读(148)
推荐(0)
编辑
posted @ 2022-08-11 21:25
折木~
阅读(21)
推荐(0)
编辑
摘要:
编码国际化实现中英文切换 i18n是国际化英文缩写 在config包下建立自己的LocaleResolver类 package com.Maple.config; import org.springframework.web.servlet.LocaleResolver; import org.th
阅读全文
posted @ 2022-08-11 11:42
折木~
阅读(54)
推荐(0)
编辑
摘要:
SpringMVC扩展 implements WebMvcConfigurer,重写一些方法 @Configuration public class MyMvcConfig implements WebMvcConfigurer { //ViewResolver 实现了视图解析器接口的类,我们就可以
阅读全文
posted @ 2022-08-10 09:19
折木~
阅读(38)
推荐(0)
编辑
摘要:
相比于springmvc-web开发要解决的问题: 导入静态资源 指定首页 jsp。模版引擎Thymeleaf 装配扩展SpringMVC 增删改查 截器和国际化 静态资源 idea按两下shift,搜索webautoConfiguration - WebMvcAutoConfigurationAd
阅读全文
posted @ 2022-08-09 23:39
折木~
阅读(27)
推荐(0)
编辑
摘要:
自动配置原理 SpringBoot官方文档中有大量的配置,我们无法全部记住 官网:https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/html/appendix-application-properties.html#cor
阅读全文
posted @ 2022-08-09 15:27
折木~
阅读(31)
推荐(0)
编辑
摘要:
JSR303数据校验 如何使用JSR303数据校验 Springboot中可以用@validated来校验数据,如果数据异常则会统一抛出异常,方便异常中心统一处理。我们这里来写个注解让我们的name只能支持Email格式; 新版idea需要在pom.xml中添加validation启动器用来支持数据
阅读全文
posted @ 2022-08-09 09:52
折木~
阅读(30)
推荐(0)
编辑
摘要:
yaml语法 SpringBoot使用一个全局的配置文件 , 配置文件名称是固定的 application.properties 语法结构 :key=value application.yaml 语法结构 :key:空格 value yaml概述 YAML是 “YAML Ain’t a Markup
阅读全文
posted @ 2022-08-08 23:08
折木~
阅读(81)
推荐(0)
编辑