
使用Amazon Cloudfront+Lambda@Edge生成缩略图

国内的云存储厂商(如阿里云,七牛云等)提供了比较方便的图片处理方案,只需要添加不同的图片访问参数值,就可以实现图片的缩放。AmazonS3并没有提供现成的方案,但我们可以通过Cloudfront+Lambda@Edge实现图片的缩放功能。
使用Amazon S3-Website生成缩略图

上一篇我们介绍了通过Cloudfront+Lambda@Edge生成缩率图,这篇简单介绍下另一种方式:通过S3静态网站托管实现生成缩略图。实现核心就是配置当S3返回404时,重定向到我们自己的图片处理服务完成缩略图创建。在这种配置下,我们需要指定Cloudfront的源为S3静态网站地址。
S3静态网站地址格式:{bucketName}.s3-website-{region}.amazonaws.com
S3地址格式:{bucketName}.s3-{region}.amazonaws.com
PF4J简单使用

PF4J是一个Java轻量级的插件框架,可以实现动态加载,执行,卸载外部插件(支持jar以及zip),具体可以看官网介绍。
本文例子基于Github地址:https://github.com/pf4j/pf4j
1 | <dependency> |
规约模式(Specification Pattern)
规约模式(Specification Pattern),简单来说就是就是约束条件,例如从数据库中获取到满足约束条件的数据(where条件之后即为约束条件):
1 | select * from `book` where `name` like `%java%` and `price` < 50; |
如果我们要用java实现类似约束,可能会想到:
1 | for (Book book : books) { |
Spring中的Properties
摘自
Environment注释:Properties play an important role in almost all applications, and may originate from a variety of sources: properties files, JVM system properties, system environment variables, JNDI, servlet context parameters, ad-hoc Properties objects, Maps, and so on. The role of the environment object with relation to properties is to provide the user with a convenient service interface for configuring property sources and resolving properties from them.



