UML类图

UML类图理解 依赖关系 public class Person { public void doSomething(){ Card card = new Card();//局部变量 .... } } public class Person { public void doSomething(Card card){//方法参数 .... } } public class Person { public void doSomething(){ int id = Card.getId();//静态方法调用 ... } } 关联关系 public class Person { public Phone phone; public void setPhone(Phone phone){ this.phone = phone; } public Phone getPhone(){ return phone; } } 聚合关系 public class Team { public Person person; public Team(Person person){ this.person = person; } } 组合关系 ...

2017年4月13日 · 1 分钟 · 183 字

IDEA中忽略spring配置文件无法识别xsd的错误

有时我们在写spring配置文件的时候,会出现idea无法识别schema,导致报错。虽然说不影响执行,但看着那红色的波浪线确实有一点不爽,寻思着能不能忽略这个错误。最开始的想法是像忽略代码语法校验那样,在Inspections中去掉相关的校验,但发现Inspections中没有schema,xsd等相关的配置,直到发现了如下的方法。 ...

2017年4月12日 · 1 分钟 · 243 字

Dubbo服务提供者使用ProGuard实现代码混淆

ProGuard能够作为maven的插件使用,让我们在原来的项目结构中,能够方便的实现代码混淆。但是网上ProGuard的资料通常都是单应用的实现,因此本文基于dubbo分布式项目,简单描述一下如何实现服务提供者的代码混淆。 ...

2017年4月11日 · 2 分钟 · 894 字

spring-boot 中文乱码解决拾遗

在spring-boot项目中返回json格式数据时出现中文乱码问题,有以下两种解决方式: 注解形式 在@RequestMapping注解中指定返回格式,编码: ...

2016年7月17日 · 1 分钟 · 290 字

spring-boot 替换内嵌tomcat版本

spring-boot中的内嵌tomcat有默认的指定版本,若想修改为其他版本,有以下两种途径: 使用parent的方式 若引入spring-boot的方式为加入<parent>: ...

2016年5月27日 · 1 分钟 · 472 字

spring-boot 实现文件上传

错误信息: Corrupt form data: premature ending 最近要实现文件上传功能,需要使用O’Reilly公司的cos上传组件,但是这个组件太过久远,最近更新是08年,早期的spring版本支持,现在已经不支持了,好在它是开源的,我根据spring早期版本里的源码自己实现了。但是出现了错误:Corrupt form data: premature ending,网上找到很多都是struts上的错误,原因是request被过滤了,cos只能接受HttpServletRequest,但在spring-boot中也有这个问题,spring-boot虽然节省了我们很多的配置工作,但也无形中为我们做了很多可能我们不需要的配置。 ...

2016年5月21日 · 2 分钟 · 890 字

spring-boot 集中处理异常

spring-boot配置方式集中处理异常,统一规范接口对外的异常输出。业务代码只需往外抛异常,不需过多关注异常的输出形式。 非系统抛出异常 对于400,404等非系统抛出的异常,使用以下方式: ...

2016年5月18日 · 1 分钟 · 355 字

spring-boot 集成Mysql和Druid连接池

概述 spring-boot默认提供了数据库和数据库连接池,按照官方文档简单配置即可。若要自定义,需要修改一些配置,本文着重描述一下spring-boot如何集成mysql和阿里的druid数据库连接池。 开始 本文环境 jdk:1.7 tomcat:7.0.55 spring-boot:1.2.3.RELEASE 修改application.properties文件 修改spring-boot默认配置文件application.properties,加入一下内容(根据实际情况修改): ...

2016年5月16日 · 2 分钟 · 747 字

spring-mvc 解决跨域问题

解决跨域访问问题,只需在被访问的应用中加入一个请求过滤器: public class CorsFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; if (req.getHeader("Origin") != null) { res.addHeader("Access-Control-Allow-Origin", "*"); } if ("OPTIONS".equals(req.getMethod())) { res.addHeader("Access-Control-Allow-Methods", "OPTIONS, GET, POST"); res.addHeader("Access-Control-Allow-Headers","Origin, Content-Type"); res.addHeader("Access-Control-Max-Age", "-1"); } chain.doFilter(req, res); } @Override public void destroy() { } @Override public void init(FilterConfig filterConfig) throws ServletException { } }

2016年1月19日 · 1 分钟 · 97 字

sonar质量分析 Tabulation characters should not be used 原因与解决

缘由 项目中使用sonar质量分析,很多代码提示:Replace all tab characters in this file by sequences of white-spaces. Tabulation characters should not be used Developers should not need to configure the tab width of their text editors in order to be able to read source code. So the use of tabulation character must be banned. ...

2015年12月22日 · 2 分钟 · 523 字