springboot
冥冥之外
冥冥之外,鸿鹄之灾
展开
-
eclipse创建springboot项目
eclise help>>Eclise marketplace>>find spring tools新建springboot项目右键>>new>>other>>spring starter pojectnext>>根据需要改内容勾选根据需要,这里只选了webimport org.springframework.stereoty...原创 2018-07-14 19:05:55 · 301 阅读 · 0 评论 -
Springboot开发非web(二)
建议使用方式一package com.lgt;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.CommandLineRunner;import org.springframework.boot.SpringApplication;import ...原创 2018-08-09 23:11:08 · 2401 阅读 · 1 评论 -
springboot去除或者更换logo
package com.lgt;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.boot.Banner;@SpringBootApplicatio...原创 2018-08-09 23:29:58 · 3338 阅读 · 0 评论 -
springboot中的actuator
fa在pom中添加起步依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>在application中配置m...原创 2018-08-11 09:10:17 · 138 阅读 · 0 评论 -
springboot使用拦截器
1.写一个方法实现HandlerInterceptorimport org.springframework.web.servlet.HandlerInterceptor;实现接口的方法可以按springmvc中一样2.编写配置类继承WebMvcAutoConfigurationAdapter并覆盖public void addInterceptors(InterceptorRe...原创 2018-08-07 23:13:24 · 135 阅读 · 0 评论 -
springboot中集成servlet
1.写的servlet类继承HttpServlet重写doget(),doPost()方法2.添加注解@WebServlet(urlPatterns="myservlet")3在启动main方法中@ServletComponentScan("com.lgt.servlet")方式二1.写一个普通的servlet类不用加注解2.写一个spring配置类如@Config...原创 2018-08-07 23:44:36 · 609 阅读 · 0 评论 -
springboot使用Filter
和servlet差不多,springboot使用Filter也有两种方法一:package com.lgt.filter;import java.io.IOException;import javax.servlet.Filter;import javax.servlet.FilterChain;import javax.servlet.FilterConfig;impor...原创 2018-08-08 21:02:38 · 186 阅读 · 0 评论 -
springboot中配置字符编码
package com.lgt.filter;import javax.servlet.Filter;import org.springframework.boot.web.servlet.FilterRegistrationBean;import org.springframework.context.annotation.Bean;import org.springframewo...原创 2018-08-08 22:39:34 · 3170 阅读 · 0 评论 -
vue axios实现文件上传后台springboot
引入jar <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.3<...原创 2019-05-23 17:27:01 · 2012 阅读 · 1 评论 -
springboot非web项目开发(一)
package com.lgt;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication...原创 2018-08-09 23:01:53 · 8246 阅读 · 0 评论 -
springboot集成redis哨兵
首先配置linux中的哨兵配置文件redis原来代码不用变,只需改一下application.properties中的配置spring.redis.password=rootspring.redis.sentinel.master=mymasterspring.redis.sentinel.nodes=192.168.137.128:26380,192.168.137.128:263...原创 2018-07-21 23:05:30 · 1619 阅读 · 0 评论 -
springboot下redis高并发下的缓存穿透
@RequestMapping("/getClass/{id}") public @ResponseBody String getClassesById(@PathVariable("id") Integer id){ RedisSerializer redisSerializer = new StringRedisSerializer(); redisTemplate.setKeyS...原创 2018-07-21 22:45:25 · 2824 阅读 · 0 评论 -
springboot配置文件配置方式
有两种配置方式1.properties同普通的properties配置文件一样简单的配置server.port=8080server.servlet-path=/2.yml利用空格和换行配置server:空格(tab键)port:8080(tab键)server.servlet-path=(空格)/空格和(tab键)不可缺少同时存在会使用properties文件,如没有会找yml文件...原创 2018-07-14 22:18:39 · 120 阅读 · 0 评论 -
Springboot多配置文件
可以根据不同环境分别配置名字比如application-dev.propertiesapplication-test.propertiesapplication-online.properties使用时在application.properties中配置spring.profiles.active=dev如果application.properties中配置文件重复配置会使...原创 2018-07-14 22:30:21 · 188 阅读 · 0 评论 -
springboot集成jsp
1.pom.xml需要加入jsp依赖jar<!-- Springboot内嵌的Tomcat对jsp的解析包 --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId&g...原创 2018-07-15 18:21:53 · 120 阅读 · 0 评论 -
springboot集成mybatis及mysql
springboot创建项目时会自动在pom中生成依赖 <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3....原创 2018-07-21 07:42:32 · 241 阅读 · 0 评论 -
springboot中的事务
在访问数据库的server上添加注解@@Transactional在主类中添加注解@EnableTransactionManagement原创 2018-07-21 08:35:58 · 134 阅读 · 0 评论 -
springboot实现RestFull
@RequestMapping("/restfull/{id}/{name}") public String restFullTest(@PathVariable("id") String id,@PathVariable("name")String name){ return "id=" + id + "&name=" + name; }用@PathVariable接收..原创 2018-07-21 09:08:36 · 1314 阅读 · 0 评论 -
springboot热部署
不用每次更改代码时都要重启服务,但是如果更改没生效还是要手动起服务<!-- 热部署插件 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> ...原创 2018-07-21 12:22:33 · 167 阅读 · 0 评论 -
springboot集成redis
linux安装redis不介绍了可视化工具redis desktop management可以直接百度下载springboot pom.xml中配置<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-...原创 2018-07-21 21:56:48 · 162 阅读 · 0 评论 -
vue axios 类的封装
new Vue({ el: '#uploadDiv', methods: { uploadConfig(e){ axios({ method:"post", url:"fileUpload", ...原创 2019-05-23 19:41:53 · 160 阅读 · 0 评论