spring
蒋桐城
泛Java技术爱好,php、Python、Angular、Vue等。
展开
-
namedParameterJdbcTemplate.update 传 null 值 报空指针 NullPointerException
Spring JdbcTemplate / NamedParameterJdbcTemplate passing null value as a parameter value原创 2023-03-07 09:24:08 · 584 阅读 · 0 评论 -
spring hibernate 启动异常 SQLServerException: 数据库中已存在名为**的对象
1.故障描述项目使用spring boot启动,application.yml配置如下: jpa: database-platform: org.hibernate.dialect.SQLServer2012Dialect database: SQL_SERVER show-sql: true open-in-view: true hibernate:...原创 2019-06-13 18:36:33 · 2914 阅读 · 0 评论 -
Tomcat启动出现ContainerBase.addChild//java.lang.StackOverflowError/springfox异常
场景使用Spring Boot开发,idea启动正常。war在Tomcat 8中启动出现异常:[localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: org.apache.catalina.LifecycleException...原创 2019-01-06 16:02:01 · 1023 阅读 · 0 评论 -
spring boot tomcat 产生大量jndi日志
现象spring boot编译出war包,在tomcat下启动后,tomcat/logs文件夹下会产生大量日志(每天10G级别)。观察日志文件可以发现,绝大数是jndi相关日志解决方案在resource文件夹下新建spring.properties文件,文件内容: spring.jndi.ignore=true参考https://jira.spring.io/brow...原创 2018-07-24 22:05:39 · 1088 阅读 · 0 评论 -
Java使用Spring Boot、Maven、Spring RestTemplate集成腾讯云通信
腾讯云通信介绍云通信 - 文档首页 - 腾讯云文档平台 - 腾讯云 云通信(Instant Messaging)承载亿级 QQ 用户即时通信技术,数十年技术积累,腾讯云为您提供超乎寻常即时通信聊天服务。针对开发者的不同阶段需求及不同场景,云通信提供了一系列解决方案,包括: Android/iOS/Windows/Web 的 SDK 组件、服务端集成接口、第三方回调接口等,利用这些组件,...原创 2018-04-19 01:04:24 · 4174 阅读 · 1 评论 -
Spring Controller 传递时间Date类型参数
Spring Controller 传递时间Date类型参数Controller代码@PostMapping(value = "/save")public String save(Model model)Domain代码pr原创 2018-01-04 16:32:10 · 9485 阅读 · 0 评论 -
Spring Security无法注入authenticationManager:No qualifying bean of type AuthenticationManager found for
出错提示Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.security.authentication.AuthenticationManager] found for dependency: e原创 2018-01-12 16:30:59 · 9704 阅读 · 0 评论 -
使用@JsonProperty解决无法同时使用@JsonIgnore及@NotNull注解
问题场景用户注册时, 用户需要填写用户名和密码. 使用spring controller来接收请求数据并验证是否. 对于密码字段, 在实体类中我们增加了@JsonIgnore 使用此注解, 在转换成json时忽略密码此字段, 避免敏感信息外泄@NotNull 使用此注解, 要求用户在注册时必须填写密码.问题原因前端数据以json格式传递过来时, 由于使用了@JsonIgnore注解, 在原创 2017-12-19 18:14:43 · 5518 阅读 · 0 评论 -
Spring RESTApi, Spring Security 自定义403返回信息
在普通的Java web 项目中,如果使用了spring security 的话,直接在application配置文件中,指定一个403error-page。 如果项目只提供restapi,也就不存在error-page这个概念甚至page这个说法了。如果请求一个没有权限的资源时,会返回一个默认的html页面。显然这不符合restapi的需要。 这种情况下,我们需要自定义一个AccessDeni原创 2017-06-14 15:18:47 · 6206 阅读 · 1 评论 -
spring mvc 使用 @ControllerAdvice 捕获404异常
如果使用web.xml来自定义404页面,可以在web.xml中添加error-page:<error-page> <!-- Missing login --> <error-code>401</error-code> <location>/general-error.html</location></error-page><error-page> <!-- Fo原创 2017-06-09 15:09:40 · 9605 阅读 · 0 评论 -
Spring Security 根据角色显示菜单是否可见
1 角色和资源映射关系确定应用所需要的角色以及对应的资源在代码完成之后就已经完全确定,项目部署之后,不会有变动。这里可以使用spring的标准标签语言来实现原创 2017-03-13 14:22:57 · 9264 阅读 · 1 评论 -
Spring MVC 4 POST提交中文乱码问题
使用Spring 4.2.5.RELEASE版本,采用0 xml文件配置。需要在配置类中加入字符编码过滤器:public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Filter[] getServletFilters()原创 2017-03-28 22:15:12 · 280 阅读 · 0 评论 -
Spring Security资源通配符冲突问题
1 系统配置使用数据库配置系统 资源-角色-用户。1 资源资源a: /admin/* 资源b:/admin/admin!index.action2 角色超级管理员:role_super 普通管理员:role_normal3 资源-角色role_super拥有资源a role_normal拥有资源b2 期望效果超级管理员能够访问所有以/admin/开头的资源(当然包括资源b),普通管理员只能访问原创 2017-01-03 13:47:43 · 2086 阅读 · 0 评论