
springboot
逗比小猫
java 前进路上的小白……
展开
-
SrpingBoot 配置文件无法识别@
springboot 配置文件中@不能识别,比对一下,要有filtering,和includes!原创 2023-05-04 16:32:21 · 511 阅读 · 1 评论 -
如何选择 Spring Cloud 和 Spring Boot 的版本?
Boot和Cloud版本选型springboot 版本https://spring.io/projects/spring-boot#learnSpringCloud 版本https://spring.io/projects/spring-cloud#learnSpringCloud 和 Springboot 版本的对照表https://spring.io/projects/spring-cloud#overview选型依据https://start.spring.io/actuator原创 2022-05-30 17:20:26 · 404 阅读 · 0 评论 -
利用jersey 实现图片的上传
一、jersey以下叙述纯属个人简介,有错请包涵指正,谢谢。项目在随着业务和时间的增加,数据量会约而来越大。这儿就对项目的个鞥新与维护产生了影响。所以,就要把应用与数据分开。应用就是纯业务,项目里面不包含数据资料。把需要的数据资料都放在另一台服务器上,这样就避免了更新维护应用服务器的时候,对数据的顾虑。jersey就能够实现这个要求。首先,平时使用的大多都是get,post请求。tomcat在默认...原创 2018-06-25 16:21:04 · 1043 阅读 · 0 评论 -
springboot2.* +mybatis +paperhelp 分页不起作用
查了好多资料,根据网络上的办法都试了一遍。最后记录下怎么解决的。首先,我觉得这个人说的有点道理,http://412887952-qq-com.iteye.com/blog/2393403说下自己怎么做的,网络上搜说,什么配置文件配置,或者在启动类,注册一个方法pageHelper。自己试一过后发现,第一就是<dependency> <groupId...原创 2018-09-11 22:33:35 · 435 阅读 · 0 评论 -
springboot2.0 集合JPA
pom.xml<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apach原创 2018-06-01 10:40:32 · 1343 阅读 · 11 评论 -
springboot2.0 集成redis
pom.xml<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apach原创 2018-06-01 17:09:05 · 728 阅读 · 0 评论 -
springboot 1.X 实现 jersey
import com.sun.jersey.api.client.Client;import com.sun.jersey.api.client.WebResource;import org.springframework.web.multipart.MultipartFile; public String doPutToFileServer(MultipartFile file, Stri...原创 2018-07-03 15:59:12 · 261 阅读 · 0 评论 -
spring boot 2 使用spring secrity
首先先讲一下什么是secrity。本人自己也是一知半解,看到了就记下来。 百度百科是这么说的:Spring Security是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制解决方案的安全框架。它提供了一组可以在Spring应用上下文中配置的Bean,充分利用了Spring IoC,DI(控制反转Inversion of Control ,DI:Dependency In...原创 2018-07-18 10:14:36 · 985 阅读 · 0 评论 -
springboot2 +mybatis+druid
之前用注解shix实现了这个,但注解也有它的不足。在复杂的大项目中通常用的都是配置文件。且在springboot2里面有好多坑,自己调了大半天终于调通了,所以记录一下,免得下次再犯。本次用的是springboot2.0.3 + maven 3.2.2 +jdk1.8 而且发现有时候版本的问题跟maven有很大的关系,同样的springboot2.X ,但maven的版本不一样,所需的一...原创 2018-07-20 15:31:06 · 9066 阅读 · 3 评论 -
spring boot中全局设置时间格式
在yml或者properties文件中设置,这里用的是ymlspring: jackson: date-format: yyyy-MM-dd #如果使用字符串表示,用这行设置格式 timezone: GMT+8 serialization: write-dates-as-timestamps: false #使用时间戳,使用数值timestamp表示日...原创 2018-08-29 13:21:03 · 8312 阅读 · 0 评论 -
命令行工具CURL
基于spring-boot的restful先贴个后台代码package com.example.rest;import java.util.ArrayList;import java.util.Date;import java.util.HashMap;import java.util.List;import java.util.Map;import javax.serv...原创 2018-08-30 15:21:33 · 1172 阅读 · 0 评论 -
springboot 多配制文件配置并且比较properties和yaml
网络上有人写了自己就不写了,点连接查看原创 2018-12-11 10:32:03 · 351 阅读 · 0 评论 -
springboot2.* 的跨域问题
最近想试试前后端分离的时候,用ajax调用springboot 的接口的时候,出现了跨域的问题!弄了老半天才不出现了。首先ajax 端设置dataType :jsonp,不起作用,有的文章说只支持get请求,自己试了好久没试出来。其次就是从sprongboot上入手了,网络上有好多文章,大多都是同一篇文章,我试了其中两个,而且网络上大多没有导入了哪个jar包,的说明。先把我的整个配...原创 2018-12-25 15:24:03 · 9180 阅读 · 4 评论 -
springboot2.0 基于注解使用mybaties
直接贴代码先:pom:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.a原创 2018-06-06 18:04:11 · 450 阅读 · 0 评论 -
springboot2.0 集成关系型数据库 jdbc + Mysql
dao:package com.springboot.dao;import com.springboot.entity.UserInfo;/** * Created by lpw'ASUS on 2018/5/30. */public interface UserinfoDao { public int insertUserInfo(UserInfo userInfo);...原创 2018-05-30 17:23:29 · 458 阅读 · 0 评论 -
springboot2.0 文件上传下载
页面 <h2>上传文件sss</h2> <form action="/file/upload" method="post" enctype="multipart/form-data" > <!--<input type="file" name="myfile" met原创 2018-05-30 16:27:02 · 3972 阅读 · 0 评论 -
在用@Query的时候发现报user没有匹配org.hibernate.hql.internal.ast.QuerySyntaxException
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: user is not mapped [select id,username,password,sex,age,truename from user where username=:username and password =:password] at org.hibe...原创 2018-05-18 14:15:07 · 522 阅读 · 0 评论 -
springboot2.0 实现热部署
在pom添加依赖<!-- spring boot 实现热部署 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifa...原创 2018-05-18 16:27:00 · 1979 阅读 · 0 评论 -
写测试类没有get方法
RequestBuilder requestBuilder =get("/controller/12/张三");没有get方法import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;手动导入,且加static原创 2018-05-18 17:10:37 · 463 阅读 · 0 评论 -
springboot2.0 配置文件取值
在配置文件application.properties 中任意定义一个值random.value 代表随机数:my.number=${random.value}在controller 中,通过 @Value(value = "${my.number}") private String value;可以获得值。例子: @RequestMapping("getnum") public ...原创 2018-05-22 17:47:12 · 1336 阅读 · 0 评论 -
springboot 2.0 多环境配置
application.properties多环境配置:需要多个properties文件:主文件:spring.profiles.active=test这个指定当前应用的配置文件为application-test.properties等于号后面的为application-test.properties文件的-后面的test,可以随意指定名称application.yaml文件,只需要一个文件my:...原创 2018-05-22 22:30:06 · 490 阅读 · 0 评论 -
springboot2.0 集成thymeleaf
thymeleaf 是按照严格的html格式来执行的,我们平时用的html不是那么严格。因此需要配置成不是很严格的,#前缀,也就是模板存放的路径spring.thymeleaf.prefix=classpath:/web/#编码格式spring.thymeleaf.encoding=UTF-8#是否开启缓存spring.thymeleaf.cache=false#后缀sprin...原创 2018-05-27 17:40:14 · 3913 阅读 · 4 评论 -
springboot2.0 对异常的处理
1.对所有异常进行处理package com.springboot2.thyemleaf.controller;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.boot.web.servlet.error.ErrorController;import org.springf...原创 2018-05-28 17:00:12 · 2304 阅读 · 0 评论 -
springboot2.0 使用ehcache缓存
首先在springboot启动类添加@EnableCaching其次在serviceImpl层的方法上添加@Cacheable(cacheNames = "zjehcache")ehcache.xml:<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLoc...原创 2018-06-04 17:17:06 · 2956 阅读 · 3 评论 -
springboot2.0 使用servlet 、filter、listener
使用servlet、filter、listener、采用在主配置类中注册类的方式package com.springboot2.thyemleaf;import com.springboot2.thyemleaf.fileter.MyFilter;import com.springboot2.thyemleaf.fileter.MyFilter2;import com.springboot...原创 2018-05-28 18:08:39 · 3358 阅读 · 0 评论 -
springboot2.0 对CORS的支持
先自定义一个配置类package com.springboot2.thyemleaf.Configuration;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.w...原创 2018-05-29 17:06:46 · 1256 阅读 · 0 评论 -
springboot2.0日志配置 logback的使用和logback.xml详解
logback的使用和logback.xml详解写的非常详细。只根据上面的我们会发现,日志要么输出到文件。要么输出到控制台不能有选择的输出满足我们的要求,这是需要看下面这个文章,多个xml路径,有选择的输出到文件。这两篇文章结合,基本满足我们实际应用的需要。为了使我们的日志更加利于观看,我们可以把日志做成html格式的,<?xml version="1.0" enc...原创 2018-05-24 15:40:54 · 7530 阅读 · 0 评论 -
springboot2.0 集成freemark
pom文件<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.原创 2018-05-24 23:00:10 · 913 阅读 · 1 评论 -
spring boot 整合redis
之前买了本书看书上做,错的,网上查的大部分也是错的。RedisTemplate,StringRedisTemplate总是注入不进去。卡了好久。最后终于发现了,RedisTemplate,StringRedisTemplate不是在dao层注入的,应该在service层,在service层一切问题都迎刃而解。...原创 2018-05-11 09:56:58 · 131 阅读 · 0 评论