自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 SpringBoot(14)整合Durid数据元

Druid配置web.xml1.导入依赖 <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.21</version> </dependency>2.填写自定义配置与数据库连接配置spring: datasource: username: roo

2020-07-27 18:10:14 127

原创 SpringBoot(13)web开发之restful风格与404页面

restful风格实列实现员工编辑功能1.传递需要修改员工信息的url<a class="btn btn-sm btn-primary" th:href="@{/emp/}+${emp.getId()}"> 编辑</a>2.接受员工信息的controller(获取员工信息) @GetMapping("/emp/{id}") public String updateEmp(@PathVariable("id")Integer id,Model model){

2020-07-23 16:34:46 297

原创 SpringBoot(12)thymeleaf组件化,遍历和三元运算符

组件化1.相同的代码可以组件化可以提高代码的复用,th:fragment="topbar"将代码组件化,单独放到一个目录下<!DOCTYPE html><html lang="en" xmlns:th="http://www.thymeleaf.org"><!--头部导航栏--><nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0" th:fragment="topbar

2020-07-22 12:19:34 541

原创 SpringBoot(11)拦截器的使用

拦截器的使用我们不能让客户通过地址栏来访问我们后台,必须通过登录才能访问后台。1.隐藏登录的访问到后台的路径,将@RequestMapping("/user/login")路径跳转到main.html,但是不存在main.html。接下来实现第二步@Controllerpublic class LoginController { @RequestMapping("/user/login") public String login( @RequestPar

2020-07-22 12:05:08 144

原创 SpringBoot(10)web开发之样式生效和国际化

样式生效html是由thyemeleaf来接管,使样式生效,使用th:src="@{/img/bootstrap-solid.svg}"来代替原先样式。国际化1.在资源下创建i18n目录,配置好需要转换得语言配置文件英文login.btn=Sign inlogin.password=Passwordlogin.remeber=Remerber melogin.tip=Please sign inlogin.username=Username中文login.btn=登录login.p

2020-07-19 15:11:29 133

原创 SpringBoot(9)MVC的原理和扩展

MVC的原理官方文档:If you want to keep those Spring Boot MVC customizations and make more MVC customizations (interceptors, formatters, view controllers, and other features), you can add your own @Configuration class of type WebMvcConfigurer but without @EnableWe

2020-07-07 17:04:46 160

原创 SpringBoot(8)thymeleaf模板导入

导入模板1.要想使用thymeleaf模板,首先 导入thymeleaf启动器,点击官网查看依赖2.导入依赖即可thymeleaf赋值与遍历Controller@Controllerpublic class indexController { @RequestMapping("/index") public String index(Model model){ model.addAttribute("user", "hello,spring");

2020-07-05 09:21:15 311

原创 SpringBoot(7)web开发之首页测试

首页的使用1.WebMvcAutoConfiguration.class中找到getWelcomePage方法 private Optional<Resource> getWelcomePage() { String[] locations = WebMvcAutoConfiguration.getResourceLocations(this.resourceProperties.getStaticLocations()); return Ar

2020-07-04 08:50:45 146

原创 SpringBoot(6)web开发之静态资源导入

静态资源1.找到自动装配的WebMvcAutoConfiguration.calss2.找到方法addResourceHandlers:加载资源处理器public void addResourceHandlers(ResourceHandlerRegistry registry) { if (!this.resourceProperties.isAddMappings()) { logger.debug("Default resource han

2020-07-04 08:27:53 187

原创 SpringBoot(5)自动装配原理深入理解

分析自动装配原理以httpEncodingAutoConfig为列://表示这是一个配置类,和以前编写的配置文件一样,也可以给容器中添加组件;@Configuration( proxyBeanMethods = false)//启动指定类的ConfigurationProperties功能;//进入这个HttpProperties查看,将配置文件中对应的值和HttpProperties绑定起来;//并把HttpProperties加入到ioc容器中@EnableConfigurati

2020-07-03 09:52:45 211

原创 SpringBoot(4)JSR303数据校验以及多环境配置

JSR303数据校验使用1.开启数据校验@Validatedpublic class Person { @Email(message = "数据格式错误") private String name ;2.运行结果default message [数据格式错误]; 格式不满足报自己定义错误。常见参数@NotNull(message="名字不能为空")private String userName;@Max(value=120,message="年龄最大不能查过120")pri

2020-07-02 08:52:22 214 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除