
spring
悟●禅●酒
能考一百分的人,你怎么知道他能考一百分是因为他的能力只有一百还是因为卷子的上限只有一百。
展开
-
no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]]
代码异常提示如下:16:59:58,897 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[file-error] - Active log file name: logs/error.log16:59:58,897 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[file-error] - File property is set to [logs/error..原创 2022-04-02 22:00:00 · 6956 阅读 · 0 评论 -
XXL-JOB漏洞解决,Eclipse Jetty HTTP请求走私漏洞
可能我使用的xxl-job版本比较老,今天安全组检查,查出来一堆堆,分享下:原创 2021-05-29 09:23:45 · 3069 阅读 · 0 评论 -
org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /index.html
此处出现该异常,我的现象是 可以访问controller 中的接口,访问不了 static 目录中的静态资源。出现的原因是,我项目本身是前后端分离的,因特殊原因做了几个配置界面,配置界面不需要分离部署,总的来说就是为了偷懒,将编译好的资源直接放置到resources/static中,请求静态资源时,前端显示:后端异常:2021-03-15 10:50:50.840 WARN 24628 --- [.0-11018-exec-3] o.s.web.servlet.PageNotFound .原创 2021-03-15 11:43:51 · 8933 阅读 · 0 评论 -
Nacos 启动异常
每个人情况不一样,我的异常提示信息如下,仅供参考:org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat at org.springframework.boot.web.serv原创 2021-03-09 18:06:22 · 789 阅读 · 0 评论 -
springboot应用,启动报错:org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputExcept
按错误,百度,大多都是说 application.yml 文件编写错误,空格多了或者少了的原因,检查下空格,发现正常。还有的说 application.yml 编码发生了改变,GBK和UTF-8两种编码格式的问题。我都试了下,本人遇到该错误时,本机本启动正常,投掷服务器,启动抛出异常,但是服务也能正常启动。想来想去,因为部分配置信息是放置在 nacos 配置中心,所以在控制台输入配置信息看看,结果发现中文注释部分的都变成乱码,果然还是 编码格式的问题,因部分配置放在配置中心,果断将中文部分的注释原创 2021-03-03 12:04:39 · 660 阅读 · 0 评论 -
在SpringBoot启动类中用@value获取配置信息为空
最近项目结构比较复杂,在生产环境和测试环境,启动类中加载的动动有差异,每次调试时改来改去,麻烦,还来想想,能否通过spring.profiles.active属性来区分测试环境和生产环境,加个判断不就解决了!resources目录如下:因项目中本来就使用了 onlinne 和 offline的配置,所以spring.profiles.active该属性绝对好使,可是在启动类中用@Value,获取到 active=null,代码如下:@SpringBootApplication(exclude =.原创 2021-02-26 13:04:48 · 2953 阅读 · 3 评论 -
SQLSyntaxErrorException: SELECT command denied to user ‘XXXXX‘@‘xxxx‘ for table ‘XXXX‘ 异常解决
项目场景:springboot 项目集成了mybatis-plus 查询数据库报该错误。java.sql.SQLSyntaxErrorException: SELECT command denied to user 'root'@'192.168.100.111' for table 'GZHZ_LUOLEI_FENXI' at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mys原创 2021-02-23 12:04:21 · 4960 阅读 · 0 评论 -
常用的类型转换器
import java.math.BigDecimal;import java.math.BigInteger;import java.nio.ByteBuffer;import java.nio.charset.Charset;import java.text.NumberFormat;import java.util.Set;/** * 类型转换器 */public class Convert{ /** * 转换为字符串<br> * 如果给定.原创 2021-02-20 13:30:22 · 184 阅读 · 0 评论 -
总结 Spring 获取配置文件属性的三种方法
方法一:通过 Environment env获取配置属性:import org.springframework.core.env.Environment;@Configurationpublic class MyBatisConfig{ @Autowired private Environment env; @Bean public void sqlSessionFactory(DataSource dataSource) throws Exception原创 2021-02-04 14:17:23 · 2708 阅读 · 0 评论 -
spring redis 工具类
此工具类出自若依管理系统,感觉封装的挺好的,特此记录。配置:spring: redis: # 地址 host: 127.0.0.1 # 端口,默认为6379 port: 6379 # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8原创 2021-02-04 13:36:37 · 116 阅读 · 0 评论 -
浅谈SpringUtils工具类常见解决问题
首先,附上工具类代码!!import org.springframework.aop.framework.AopContext;import org.springframework.beans.BeansException;import org.springframework.beans.factory.NoSuchBeanDefinitionException;import org.springframework.beans.factory.config.BeanFactoryPostProces原创 2021-01-17 15:31:37 · 1553 阅读 · 0 评论 -
Required request part ‘file‘ is not present
本人遇到问题是错误信息如下:org.springframework.web.multipart.support.MissingServletRequestPartException: Required request part 'file' is not present at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.handleMissingValue(RequestParamMethodA原创 2021-01-02 11:58:29 · 5668 阅读 · 1 评论