Spring MVC MyBatis Integration Tutorial

Last few months, I'm working on a project with Spring MVC and Hibernate. Now, I want to try MyBatis. In this article, I'll tell you how to useMyBatis with Spring MVC. According to Wikipedia, database transaction should provide an “all-or-nothing” proposition, stating that each work-unit performed in a database must either complete in its entirety or have no effect whatsoever. Further, the system must isolate each transaction from other transactions, results must conform to existing constraints in the database, and transactions that complete successfully must get written to durable storage. So on this example, I'm trying to create a simple MyBatis database transaction, managed by Spring Framework. Okay, so this is my pom file, as you can see, I'm using…

Continue Reading

Use CDN Service in Spring MVC

A few days ago, I created TestZilla on Aliyun Elastic Compute Service. However, with the increment of PV, I decided to use CDN to caches static files(images, css and javascripts). But there's no one told me how to use CDN with Spring MVC, so I asked a question on StackOverflow. Setup Spring Configuration First of all, you need to use PropertyPlaceholderConfigurer in Spring Configuration(such as dispatcher-servlet.xml) Of course, you need to add XML Namespaces: Create Properties File As I was declared in the Spring Configuration, there's a testzilla.properties in classpath. You need to create the file and add following lines in it: Of course, you can add extra properties if needed: Use CDN Property in JSP Now, we can get the…

Continue Reading

Create Unit Testing Cases in Zend Framework

A solid unit test suite is essential for ongoing development in large projects, especially those with many people involved. Going back and manually testing every individual component of an application after every change is impractical. Your unit tests will help alleviate that by automatically testing your application’s components and alerting you when something is not working the same way it was when you wrote your tests. The Zend Framework 2 API uses PHPUnit, and so does this tutorial application. A detailed explanation of unit testing is beyond the scope of this tutorial, so we will only provide sample tests for the components in the pages that follow. This tutorial assumes that you already have PHPUnit installed. Setting up the Tests…

Continue Reading

Create CDN View Helper in Zend Framework 2

In this article, you will learn how to create a custom view helper in Zend Framework 2. A concrete example will be used; a helper which generates links for a subdomain, intended for storing static files. This is especially useful if you wish to use a Content Delivery Network (CDN). With very little modification, the helper can be made generic to support links to subdomains for all purposes. The Helper Class Let us begin by creating the helper class. It can be added within any module, but a suitable place would be within the Application module, provided that you made use of the Skeleton Application. Create a file CdnHelper.php in zf2-tutorial\module\Application with the following subdirectories: There are a few things…

Continue Reading

Building and Installing HHVM on CentOS 7

What's HHVM? HHVM is an open-source virtual machine designed for executing programs written in Hackand PHP. HHVM uses a just-in-time (JIT) compilation approach to achieve superior performance while maintaining the flexibility that PHP developers are accustomed to. To date, HHVM (and its predecessor HPHPc before it) has realized over a 9x increase in web request throughput and over a 5x reduction in memory consumption for Facebook compared with the PHP 5.2 engine + APC. HHVM runs much of the world’s existing PHP. Developers and hosts are adopting HHVM. We are aware of minor incompatibilities (please open issues when you find them), but we can run the top 20 Github PHP frameworks out of the box. The HHVM team, along with many wonderful community members, has made…

Continue Reading

Sending Email with Spring MVC Using Template

This tutorial provides a sample spring MVC application that allows user sending an e-mail message. In this tutorial, you are supposed to familiar with Java EE development as well as developing Spring MVC-based applications. Spring Framework’s Support for E-mail Based on JavaMail, Spring framework provides high-level abstraction API which greatly simplifies e-mail sending process. Let’s take a brief look at this API in the following class diagram: To send e-mail messages, we can use an implementation of interface MailSender – the JavaMailSenderImpl class which is built upon on JavaMail. It’s convenient to configure this implementation as a bean in Spring’s context: Dependencies(pom.xml) The Mail Template File Name: verifyEmail.vm File Location: classpath: /mails/verifyEmail.vm (You can change this in configuration file) The…

Continue Reading
Contact Us
  • SenseTime Research, Shenzhen Bay Eco-Technology Park
  • cshzxie [at] gmail [dot] com