springboot
文章平均质量分 60
这个世界太疯狂了
这个作者很懒,什么都没留下…
展开
-
SpringBoot静态页面访问问题总结
文章目录1.不使用thymeleaf2.使用thymeleaf思考三个问题,文末有答案。怎么让我直接访问页面不会报错,而且页面不放在 static下?怎么让我的页面不放在 templates下,通过后台路径跳转也能访问到?怎么让我的页面放在任意目录,直接访问、通过后台路径跳转都能访问到?1.不使用thymeleaf直接访问,默认访问的路径为 /resources/static/ ,可以在配置文件中指定静态资源的访问路径。直接访问 http://localhost:8080/index.ht原创 2021-07-03 21:43:06 · 273 阅读 · 0 评论 -
加载resources目录下的文件
maven项目加载文件资源文章目录maven项目加载文件资源加载路径问题6种加载文件方法resources目录下放的静态资源,打包后都会放在classpath下面。在idea中打包后会放在target/classes目录下。加载路径问题public class PathProblem { public static void main(String[] args) { // 编译后,项目根路径,写法1 String url1 = PathProblem.cla原创 2021-05-07 10:04:23 · 2107 阅读 · 0 评论 -
springboot+bootstraptable
springboot+bootstraptable项目采用的是springboot+bootstraptable搭建的demo基础的增删改查已经实现html页面<!DOCTYPE html><html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"><head> <meta name="viewport" content="width=device-width"/> <titl原创 2021-03-12 23:56:38 · 733 阅读 · 0 评论 -
springboot嵌入式servlet容器
EmbeddedServletContainerFactory: 嵌入式servlet容器工厂。实现如下 JettyEmbeddedServletContainerFactory TomcatEmbeddedServletContainerFactory UndertowEmbeddedServletContainerFactory EmbeddedServletContainer: 嵌入式的Servlet容器。实现如下 JettyEmbeddedServletContainer Tomca.原创 2021-02-03 16:14:52 · 346 阅读 · 0 评论 -
springboot错误处理机制
1.一但系统出现4xx或者5xx之类的错误;ErrorPageCustomizer就会生效(定制错误的响应规则),决定去哪个请求路径。默认/error ServerProperties-->ErrorProperties-->(@Value("${error.path:/error}")) 从文件中获取error.path路径,如果没有就使用/error请求路径 private String path = "/error";2.接下来由BasicErrorContro.原创 2021-02-03 14:55:22 · 260 阅读 · 0 评论 -
SpringBoot自动配置原理
springboot 1.5.9.RELEASE主配置类@SpringBootApplication(复合注解) 1.@SpringBootConfiguration:表示这是一个SpringBoot的配置类 2.@EnableAutoConfiguration:开启自动配置功能 2.1@AutoConfigurationPackage 将主配置类(@SpringBootApplication标注的类)的所在包及下面所有子包里面的所有组件扫描到Spring容器 2.2@Impor原创 2021-02-01 15:13:13 · 72 阅读 · 0 评论 -
List去重复
文章目录5.List去重5.1利用set去重5.2循环去重复5.3保顺序去重5.4利用contains方法5.List去重参考文章去重代码:List<String> list = new ArrayList<>(); list.add("张三"); list.add("张三"); list.add("李四"); ...原创 2019-06-21 10:55:53 · 68 阅读 · 0 评论 -
解决端口被占用了
启动服务的时候,显示端口被占用。解决:调出命令行netstat -ano调出任务管理器ctrl +shift + esc然后选择需要结束的进程,结束掉,重启服务即可。...原创 2019-06-06 09:42:50 · 182 阅读 · 0 评论 -
springboot记录日志
使用logback日志框架日志级别为info依赖:<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId></dependency>...原创 2019-05-27 10:58:18 · 2360 阅读 · 0 评论 -
前后端分离项目,请求跨域解决
springboot+vue前后端分离项目前端发送请求,产生跨域问题created() { this.$http.get("http://localhost:9090/index").then(result => { var user = result.body.data; }); }控制台报错解决办法:在服务器设置允许跨域请求package ...原创 2019-05-16 16:18:59 · 806 阅读 · 0 评论 -
HttpServletResponse的简单使用
利用HttpServletResponse进行文件的上传与下载springboot项目package com.info33.fileupanddown.utils;import org.apache.commons.io.IOUtils;import org.springframework.web.bind.annotation.RequestMapping;import org....原创 2019-05-07 17:13:23 · 2597 阅读 · 0 评论 -
velocity的简单使用
velocity的简单使用文件目录结构,只有Demo1和hellovelocity.vm有用,其他的只是测试,可忽略利用代码模板生成需要的代码文件getPro与getVel区别在于配置的方式不一样需要更改Template template = ve.getTemplate(“templates/hello.vm”,“UTF-8”);中的模板路径package com.info33.ve...原创 2019-05-05 11:41:56 · 176 阅读 · 0 评论