自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(36)
  • 资源 (1)
  • 收藏
  • 关注

原创 spring中bean的生命周期

    在bean准备就绪之前, bean工厂执行了若干启动步骤。我们对图进行详细描述:1. Spring对bean进行实例化;2. Spring将值和bean的引用注入到bean对应的属性中;3. 如果bean实现了BeanNameAware接口, Spring将bean的ID传递给setBean-Name()方法;4. 如果bean实现了BeanFactoryAwa...

2018-09-10 11:41:22 163

转载 微信公众号用户与网站用户的绑定方案

现在很多网站都已经建立了一套完整的用户账号体系,基于这套体系,再做其他应用的用户扩展就非常方便。例如,有了微软的outlook账户,就可以登录win8,可以登录微软的邮箱,还可以登录skype。同样地,一个Apple ID可以享受苹果的所有服务。正所谓,一个账号,处处使用。对于企业,可能会有产品线通常有网站,app,微信公众号等。统一各产品线的账号体系,实现一个账号处处使用的目标是非常有必要的。网...

2018-05-22 18:23:56 2211

原创 web前端左右选择框移动,及查询

“不要重复造轮子 Stop Trying to Reinvent the Wheel”, 可能是每个程序员入行被告知的第一条准则。在前人的基础上进行了改进

2017-07-24 09:41:45 2509

原创 通过HIBERNATE查询慢,直接在数据库中执行快的问题

今天遇到一个非常怪异的问题,一个HQL通过hibernate执行大概需要400秒左右,但把这个HQL生成的SQL直接到数据库中执行,却只要0.05秒,差距非常大,试了N种方法不能解决,最后发现表中有个字段映射是“Number--Varchar”,java中是Long,数据库中是Varchar,HQL中查询条件写的是 id=?,参数是用的Long类型,如果直接改为String类型,执行速度就能达到1...

2019-03-26 20:34:49 4925

转载 Mysql统计每个小时或半小时数据的数量

Mysql 查询一天中,每个小时数据的数量Mysql 查询一天中每半小时记录的数量

2019-03-06 11:03:45 3751

原创 桥梁模式( Bridge Pattern)

        文档地址:《设计模式之禅》​​​​​​​        切入故事: 我有一个梦想……        定义: Decouple an abstraction from its implementation so that the two can vary independently.(将抽象和实现解耦, 使得两者可以独立地变化。 )        通用类图:     ...

2018-10-10 15:28:32 392

原创 享元模式 (Flyweight Pattern)

        文档地址:《设计模式之禅》​​​​​​​        切入故事: 内存溢出, 司空见惯        定义: Use sharing to support large numbers of fine-grained objects efficiently.(使用共享对象可有效地支持大量的细粒度的对象。 )        通用类图:                ...

2018-10-10 15:26:56 181

原创 解释器模式 (Interpreter Pattern)

        文档地址:《设计模式之禅》​​​​​​​        切入故事: 四则运算你会吗        定义: Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences...

2018-10-10 15:24:49 175

原创 状态模式

        文档地址:《设计模式之禅》​​​​​​​        切入故事: 城市的纵向发展功臣——电梯        定义: Allow an object to alter its behavior when its internal state changes.The object will appear to change its class.(当一个对象内在状态改变时允许其...

2018-10-10 15:23:18 109

原创 访问者模式 (Visitor Pattern)

          文档地址:《设计模式之禅》​​​​​​​          切入故事: 员工的隐私何在        定义: Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without chan...

2018-10-10 15:22:15 424

原创 备忘录模式 (Memento Pattern)

        文档地址:《设计模式之禅》​​​​​​​        切入故事: 如此追女孩子, 你还不乐        定义: Without violating encapsulation,capture and externalize an object's internal state so that the object can be restored to this stat...

2018-10-10 15:20:52 113

原创 门面模式 (Facade Pattern)

文档地址:《设计模式之禅》​​​​​​​切入故事:我要投递信件定义: Provide a unified interface to a set of interfaces in a subsystem.Facade defines a higher-level interface that makes the subsystem easier to use.(要求一个子系统的外部与其内部的...

2018-10-10 15:19:56 165

原创 观察者模式( Observer Pattern)

文档地址:《设计模式之禅》​​​​​​​切入故事: 韩非子身边的卧底是谁派来的定义: Define a one-to-many dependency between objects so that when one object changes state,all its dependents are notified and updated automatically.(定义对象间一种一...

2018-10-10 15:16:52 106

原创 组合模式( Composite Pattern)

文档地址:《设计模式之禅》切入故事: 公司的人事架构是这样的吗定义: Compose objects into tree structures to represent part-whole hierarchies.Composite lets clients treat individual objects and compositions of objects uniformly.(将...

2018-10-10 15:07:27 121

原创 迭代器模式 (Iterator Pattern)

文档地址:《设计模式之禅》​​​​​​​切入故事: 整理项目信息——苦差事定义: Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.(它提供一种方法访问一个容器对象中各个元素, 而又不需暴露该对象的内部...

2018-10-09 15:45:41 81

原创 适配器模式( Adapter Pattern)

文档地址:《设计模式之禅》​​​​​​​切入故事: 业务发展——上帝才能控制定义: Convert the interface of a class into another interface clients expect.Adapter lets classes work together that couldn't otherwise because of incompatible ...

2018-10-09 15:44:38 98

原创 策略模式( Strategy Pattern) 也叫做政策模式(Policy Pattern)

文档地址:《设计模式之禅》​​​​​​​定义: Define a family of algorithms,encapsulate each one,and make them interchangeable.(定义一组算法, 将每个算法都封装起来, 并且使它们之间可以互换。 )通用类图:                                 ● Context封装角色...

2018-10-09 15:43:03 1118

原创 装饰模式(Decorator Pattern)

文档地址:《设计模式之禅》​​​​​​​切入故事: 罪恶的成绩单定义: Attach additional responsibilities to an object dynamically keeping the same interface.Decorators provide a flexible alternative to subclassing for extending fu...

2018-10-09 15:40:58 114

原创 责任链模式

文档地址:《设计模式之禅》切入故事: 古代妇女的枷锁——“三从四德”定义: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.Chain the receiving objects and pass the ...

2018-10-09 15:33:34 346

原创 命令模式

文档地址:《设计模式之禅》​​​​​​​切入故事: 项目经理也难当定义: Encapsulate a request as an object,thereby letting you parameterize clients with different requests,queue or log requests,and support undoable operations.(将一个请...

2018-10-09 15:31:12 169 1

原创 中介模式

文档地址:《设计模式之禅》​​​​​​​切入故事: 进销存管理是这个样子的吗?定义: Define an object that encapsulates how a set of objects interact.Mediator promotes loose coupling by keeping objects from referring to each other explici...

2018-10-09 15:29:28 110

原创 原型模式(Prototype Pattern)

文档地址:《设计模式之禅》​​​​​​​切入故事: 个性化电子账单定义: Specify the kinds of objects to create using a prototypical instance,and create new objects by copying this prototype.(用原型实例指定创建对象的种类, 并且通过拷贝这些原型创建新的对象。 )通用类...

2018-10-09 15:18:43 149

原创 代理模式( Proxy Pattern)

文档地址:《设计模式之禅》​​​​​​​切入故事: 我是游戏至尊定义: Provide a surrogate or placeholder for another object to control access to it.(为其他对象提供一种代理以控制对这个对象的访问。 )通用类图:                     ● Subject抽象主题角色       ...

2018-10-09 15:15:02 76

原创 建造者模式( Builder Pattern)

文档地址:《设计模式之禅》​​​​​​​ 切入故事:变化是永恒的 定义: Separate the construction of a complex object from its representation so that the sameconstruction process can create different representations.(将一个复杂对象的构建与它的表...

2018-10-09 15:10:57 78

转载 Spring切入点表达式常用写法

  Spring切入点表达式常用写法自从使用AspectJ风格切面配置,使得Spring的切面配置大大简化,但是AspectJ是另外一个开源项目,其规则表达式的语法也稍稍有些怪异。 下面给出一些常见示例的写法: 比如,下面是一个对Service包上所有方法的切面配置<aop:config>                 <aop:pointcut i...

2018-09-10 11:21:16 1031

原创 在Spring的配置文件里面配置AOP出现BeanCreationExceptiony异常

学习spring实战手动配置切面时出现BeanCreationExceptiony异常警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creat...

2018-09-10 10:58:16 1514

原创 模板方法模式

文档地址:《设计模式之禅》​​​​​​​第10章:模板方法模式( Template Method Pattern)    切入故事:辉煌工程——制造悍马  定义: Define the skeleton of an algorithm in an operation,deferring some steps to subclasses.Template Method lets subc...

2018-07-30 17:47:14 105

原创 工厂模式

文档地址:《设计模式之禅》​​​​​​​第八章:工厂模式(Factory Pattern)    切入故事:女娲造人的故事    定义: Define an interface for creating an object,but let subclasses decide which class to instantiate.Factory Method lets a class d...

2018-07-30 17:40:48 80

原创 单例模式

文档地址:《设计模式之禅》​​​​​​​第七章:单例模式( Singleton Pattern)        切入故事:唯一的皇帝        定义: Ensure a class has only one instance, and provide a global point of access to it.(确保某一个类只有一个实例, 而且自行实例化并向整个系统提供这个实例。...

2018-07-30 17:33:11 113

原创 六大设计原则

文档地址:《设计模式之禅》​​​​​​​第1章 单一职责原则( Single Responsibility Principle,SRP)       定义: There should never be more than one reason for a class to change.  应该有且仅有一个原因引起类的变更;       好处:                 ● ...

2018-07-30 17:27:03 116

原创 解决Error resolving template template might not exist or might not be accessible问题

thymeleaf + Spring Boot 在开发环境正常,但用jar运行时报错 Error resolving template template might not exist or might not be accessible; 这个问题我们都很好明白,就是模板页不存在,但是实际上它能找到模板页,但是在使用th:include标签的时候才会出错,这就是问题的症结所在。其实这...

2018-07-25 18:15:00 42129 9

原创 ajax传多个实体参数到后端controller

当jQuery 发送ajax请求需要传递多个参数时,如果参数过多,Controller接收参数时就需要定义多个参数,这样接口方法会比较长,也不方便。同时当ajax需要传多个实体参数时,后台也不好接收

2017-07-21 17:25:44 5305

转载 swagger 常用注解

​ Swagger是一个简单又强大的能为你的Restful风格的Api生成文档工具。在项目中集成这个工具,根据我们自己的配置信息能够自动为我们生成一个api文档展示页,可以在浏览器中直接访问查看项目中的接口信息,同时也可以测试每个api接口。Swagger生成的api文档是实时更新的,你写的api接口有任何的改动都会在文档中及时的表现出来。

2017-07-21 17:08:13 267

转载 Spring 注解

声明Bean的注解:@Component : 组件,没有明确的角色 @Service : 在业务逻辑层(service层)使用 @Repository : 在数据访问层(dao层)使用. @Controller : 在展现层(MVC--SpringMVC)使用 注入Bean的注解:@Aautowired : Spring提供的注解. @Inject : JSR-330提供的注...

2017-07-21 17:05:20 201

原创 Mybatis注解

@CacheNamespace(size = 512) : 定义在该命名空间内允许使用内置缓存,最大值为512个对象引用,读写默认是开启的,缓存内省刷新时间为默认3600000毫秒,写策略是拷贝整个对象镜像到全新堆(如同CopyOnWriteList)因此线程安全。 @SelectProvider(type = TestSqlProvider.class, method = "getSql") ...

2017-07-21 17:01:00 331

原创 Hibernate注解

1.类级别注解@Entity     映射实体类@Table    映射数句库表 @Entity(name="tableName") - 必须,注解将一个类声明为一个实体bean。属性:name - 可选,对应数据库中的一个表。若表名与实体类名相同,则可以省略。 @Table(name="",catalog="",schema="")  - 可选,通常和@Entit...

2017-07-21 16:51:11 202

设计模式之禅(第二版)

第一部分 大旗不挥, 谁敢冲锋 ——6大设计原则全新解读 第1章 单一职责原则 第2章 里氏替换原则 第3章 依赖倒置原则 第4章 接口隔离原则 第5章 迪米特法则 第6章 开闭原则 第二部分 真刀实枪 ——23种设计模式完美演绎 第7章 单例模式 第8章 工厂方法模式 第9章 抽象工厂模式 第10章 模板方法模式 第11章 建造者模式 第12章 代理模式 第13章 原型模式 第14章 中介者模式 第15章 命令模式 第16章 责任链模式 第17章 装饰模式 第18章 策略模式 第19章 适配器模式 第20章 迭代器模式 第21章 组合模式 第22章 观察者模式 第23章 门面模式 第24章 备忘录模式 第25章 访问者模式 第26章 状态模式 第27章 解释器模式第28章 享元模式 第29章 桥梁模式 第三部分 谁的地盘谁做主 ——设计模式PK 第30章 创建类模式大PK 第31章 结构类模式大PK 第32章 行为类模式大PK 第33章 跨战区PK 第四部分 完美世界 ——设计模式混编 第34章 命令模式+责任链模式 第35章 工厂方法模式+策略模式 第36章 观察者模式+中介者模式 第五部分 扩展篇 第37章 MVC框架 第38章 新模式

2018-09-10

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除