Using Apache POI library to read contents from old Microsoft .doc file, including paragraphs and tables in order. Figure out a workaround to the strange situation that HWPFDocument eats or swallows some characters and beeps.
How to extract XML data from the XFA form using Java with iText7
What is the XFA form? First, you need to know there are two types of PDF forms, XFA, and Acroform. (See the doc) Acroform is an old interactive form technology by Adobe, but it is more commonly used and supported by many third-party software. XFA is newer than Acroform, it's…
如何处理数据库并发操作
1. 基本问题 假设项目的用户信息包括用户积分,现在需求是给用户增加积分。在Service层有一个方法addCredits负责执行增加积分的操作。 @Override @Transactional("fproxy") public vo ...
基于Spring、Hibernate实现通用Dao层
这两天又捡起来老司机的web端代码,需要增加一些新的功能,比如说充值卡(PrepaidCard)模块。在写Dao层的时候发现好麻烦呀,每个实体类都要写一个对应的Dao(还包括接口跟实现),而大部分Dao方法都是基本的增删查改操作(CRUD)。比如getBy ...
spring mvc给freemarker传全局的值
通常spring mvc通过model给freemarker view传值,这是一个局部的概念,针对的是每个页面。有时候,我们会想给整个freemarker传一些全局的值。比如网站的url前缀,比如静态资源的路径,这些值在每个页面几乎都会需要用到,但我们不 ...
在spring框架中发送邮件
spring封装了一个邮件发送类:org.springframework.mail.javamail.JavaMailSender,这个JavaMailSender底层实现依赖的是公开的JavaMail API。所以要让spring的JavaMailSen ...
关于三层架构及事务的异常处理
我的个人理解,在三层架构的开发模式中。 dao层 负责对数据库进行增删查改基本操作。比如新建一个用户信息,更新一个用户信息。 每个dao层的方法都必须是单元操作,即不允许多次读写数据库,因此无需在dao层加事务处理。 在dao层无需手动去处理异常,异常由系 ...
小内存运行kafka
按照kafka的官方文档(http://kafka.apache.org/documentation.html#quickstart)试了一下,解压程序包后运行 $bin/zookeeper-server-start.sh config/zookeeper ...
Spring的@Autowired与自动代理
我想Spring框架的优点,第一条应该就是Spring的依赖注入了吧。尤其@Autowired这个注解,甚至可以直接注解在私有成员变量上而不用去写setter方法。之前看《Spring实战》这书的时候,里面说autowired自动注入是byType的,当时 ...
Entity的继承以及泛型Dao(二)
一、继承与泛型都是因为懒 接着先前的例子,我们已经把Odds1x2与OddsHandicap这两个实体类的共同属性抽离出来放在他们的抽象父类Odds中。那么接下来要做的就是实现实体类相应的Dao类型。最简单的实现方法就是每个Entity对应一个Dao,每个 ...