springboot
bouncyself
这个作者很懒,什么都没留下…
展开
-
springboot thymeleaf抽取网页公共片段
1.把公共片段放在bar.html中分别是(只用topbar举例)<!--topbar--><nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0" th:fragment="topbar"> <a class="navbar-brand col-sm-3 col-md-2...原创 2019-11-16 19:14:23 · 190 阅读 · 0 评论 -
springboot获取路径上的id
//员工删除 @RequestMapping("/emp1/{id}") public String deleteEmployee(@PathVariable("id") Integer id){ employeeDao.delete(id); return "redirect:/emps"; }@PathVariable(“id”)用这...原创 2019-11-16 19:10:17 · 1535 阅读 · 0 评论 -
springboot配置拦截器
1.两个类package com.geek.config;import com.geek.component.LoginHandlerInterceptor;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;impo...原创 2019-11-16 19:07:57 · 114 阅读 · 0 评论 -
thymeleaf基础语法
1.Controller类里的方法@RequestMapping("/success") public String success(Map<String,Object> map){ map.put("hello","<h1>你好</h1>"); //map.put("user"); m...原创 2019-11-09 19:35:07 · 145 阅读 · 0 评论 -
springboot的modelandview找不到路径
1.代码@RequestMapping("/login") public ModelAndView login(){ return new ModelAndView("login"); }2.错误原因没有导入thymeleaf依赖<dependency> <groupId>org.springframewor...原创 2019-11-06 16:53:16 · 1955 阅读 · 0 评论 -
spring boot踩坑合集
1.报错原因报错Correct the classpath of your application so that it contains a single, compatible vers解决方法:去maven仓库把重复的jar包删了就行原创 2019-11-06 16:50:43 · 149 阅读 · 0 评论 -
springboot连接数据库
1.使用jdbc连接数据库application.properties文件#设置数据库连接spring.datasource.driver-class-name=com.mysql.jdbc.Driverspring.datasource.username=rootspring.datasource.password=123456spring.datasource.url=jdbc...原创 2019-11-02 15:42:12 · 995 阅读 · 0 评论 -
springboot的application.properties文件
1.@ConfigurationProperties和@Value的区别将配置文件中配置的每一个属性的值,映射到这个组件中@ConfigurationProperties:告诉Springboot将本类中的所有属性和配置中的相关属性进行绑定(默认从全局配置文件2中获取值)prefix = “person”:配置文件中哪个下面的所有属性进行–映射只有这个组件是容器中的组件,才能用容器提供的...原创 2019-10-30 21:48:36 · 122 阅读 · 0 评论 -
springboot第一个应用helloworld
1.创建springboot项目后,新建java应用类@SpringBootApplicationpublic class SpringBoot01WorldQuickApplication { public static void main(String[] args) { SpringApplication.run(SpringBoot01WorldQuickApplication...原创 2019-10-29 22:40:49 · 153 阅读 · 0 评论 -
springboot入门hello world
1.快捷创建springboot应用2.在pom.xml中的parent依赖版本最好用1.5.21.RELEASE,不然容易报错原创 2019-10-29 22:27:14 · 91 阅读 · 0 评论