![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring boot
文章平均质量分 64
迷雾骑士
埋头努力,剩下的交给时间
展开
-
springboot 多数据源事务回滚失效
springboot版本:2.0.1.RELEASE问题:发生多数据源事务回滚失效现象原因:在某个数据源上加了@Primary注解,然后需要回滚的service方法是另一个数据源的数据解决方法:在当前的方法上指明需要使用的事务的名称,即@Transactional("abcTransactionManager")PS:有网友说在2.0版本之后,不再需要在数据源上加@Primary注解,未验证该说法。...原创 2021-03-08 17:40:30 · 1615 阅读 · 5 评论 -
Thymeleaf使用与语法最全详解(精)
Spring Boot模板引擎thymeleaf什么是Thymeleaf? 为什么要使用Thymeleaf? 使用Thymeleaf步骤 Thymeleaf语法详细 源码分析 th属性 1、Thymeleaf是什么?简单说, Thymeleaf 是一个跟 Velocity、FreeMarker 类似的模板引擎,它可以完全替代 JSP 。从代码层次上讲:Thymeleaf是一个java类库,他是一个xml/xhtml/html5的模板引擎,可以作为mvc的web应用的view层。转载 2021-01-27 11:35:55 · 10544 阅读 · 0 评论 -
springboot如何配置,同时支持https和http
1、配置资源文件#http 配置http.port=8001#https 配置server.port=8002server.ssl.key-store=classpath:xxxxxx.pfxserver.ssl.key-store-password=ssssssssssserver.ssl.keyStoreType=PKCS122、启动类中添加 @Value("${...原创 2020-03-15 16:11:19 · 724 阅读 · 0 评论 -
微信公众号配置指南
1、开发=》基本配置注意:配置服务器地址(URL)时,需要先发布项目,保证验签的接口checkSignature是可以被微信调用的。2、设置=》公众号设置=》功能设置(配置业务域名、JS接口安全域名、网页授权域名)注意:进行以上三项设置时,需要在项目中保证微信提供的那个MP_verify_xxxxxxxxxxxx.txt文件能在浏览器中被访问到。...原创 2020-01-02 16:03:38 · 421 阅读 · 0 评论 -
SpringBoot使用@Value给静态变量注入值
最近在项目中遇到一个问题: 在给static修饰的变量做@Value注入时,发现变量值为null,在网上查了些资料,发现@Value只能给普通变量做值注入,那么如何给静态变量做值注入呢?解决办法:1、先在类名上加@Component注解2、然后再使用setXxxxxx(abc)方法,并在setXxxxxx(abc)上面加上@Value注解,如下: @Value("${d...原创 2019-04-19 09:50:20 · 1760 阅读 · 0 评论 -
The temporary upload location [/tmp/tomcat.4568985732109845389.8080/work/Tomcat/**] is not valid
springboot项目突然报错:Servlet.service() for servlet [dispatcherServlet] in context with path [/cloud-disk] threw exception [Request processing failed; nested exception is org.springframework.web.multipa...转载 2019-04-15 10:43:20 · 6023 阅读 · 5 评论 -
springboot log打印日志时中文乱码,file.encoding=ANSI_X3.4-1968
springboot项目启动后,发现log中打印的日志有中文乱码问题,一开始以为是CentOS7没有安装中文字符集[root@izbp15jhfolqh6oj1ahcu6z springboot]# localeLANG=zh_CN.UTF-8LC_CTYPE="zh_CN.UTF-8"LC_NUMERIC="zh_CN.UTF-8"LC_TIME="zh_CN.UTF-8"LC_...原创 2019-04-17 18:33:35 · 10082 阅读 · 1 评论 -
springboot之修改内置tomcat配置项
1.spring boot默认端口号是8080,如果要修改端口的话,只需要修改application.properties文件,在其中加入 例如:server.port=80812.在正常的项目中,项目路径都是localhost:8080+项目名称+相应的访问路径,在spring boot中默认并没有项目名称而是直接访问localhost:8080/访问路径,这种方式的路径格式肯定是不...转载 2019-04-17 10:39:42 · 3509 阅读 · 0 评论 -
nginx、域名、https 获取不到header的自定义参数的值
技术框架是spring boot,前端将token放在header里面,自定义一个参数,然后再后台通过request.getHeader("参数")获取;1、我们在自己的本地和测试环境下是ok的,当使用测试环境的https://www.xxxxx/访问的时候就出问题;后跟踪日志发现获取到token也就是getHeader为空了;2、由于运维和我们是分开的,所以ng的配置修改不方便,我们自己...转载 2019-02-28 15:36:10 · 2730 阅读 · 0 评论 -
centOS7.2将自定义的脚本设置成service,并开机启动
spring boot的jar包部署上线时,希望能将其设置成service,并能开机启动,步骤如下:1、准备好脚本(网上很多,此处不写了)2、建立一个软连接到/etc/rc.d/init.d目录下ln -s /springboot/biz /etc/rc.d/init.d 源文件(绝对路径) 目标路径(绝对路径)3、增加执行权限:chmod +x biz...原创 2019-01-15 16:46:56 · 2197 阅读 · 0 评论 -
Https背景与证书在spring boot项目中的使用
转自:https://www.cnblogs.com/vincent0928/p/6925893.html https背景(本人学习参考中觉得不错的几篇文章)https如何解决安全问题 HTTPS 理论基础及其在 Android 中的最佳实践 什么是https关于https的个人总结总所周知http是通过明文传输的,其不够安全,传输过程中容易被劫持查看传输内容甚至修改内容,经...转载 2019-01-11 15:18:07 · 450 阅读 · 0 评论 -
Failed to configure a DataSource
在用spring cloud的时候,先创建了一个parent项目,然后分别加入eureka-server模块、短信模块,运行正常。最后再加入支付模块(需整合myBatis、mySql)之后,eureka-server模块和短信模块报错:Description:Failed to configure a DataSource: 'url' attribute is not specified a...原创 2018-06-28 11:50:54 · 51082 阅读 · 15 评论 -
Spring Boot启动后不报错,但是接口调用失败
刚开始学习Spring Boot,在MyEclipse中建立了一个Spring Boot项目,启动的时候一切正常,但是在执行controller中的方法的时候失败: 图一Controller类:@RestControllerpublic class HelloContro...原创 2018-03-29 15:18:07 · 10419 阅读 · 0 评论 -
Myeclipse下使用Maven搭建spring boot项目
开发环境:Myeclipse2014、JDK1.7、Tomcat8.0。Myeclipse下使用Maven搭建spring boot项目,详细过程如下:1. New -> Project... -> Maven Project2. Next, 选择Use default Workspace location。3. Next, 选择“maven-archetype-webapp”创建一个...转载 2018-02-26 17:15:58 · 2891 阅读 · 0 评论