Skip to content
A simple RESTful CRUD service
Branch: master
Clone or download
Latest commit 7230af9 May 23, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main update to act-1.8.22 May 23, 2019
.gitignore initial commit Oct 27, 2018
LICENSE initial commit Oct 27, 2018 update README Oct 27, 2018
pom.xml update to act-1.8.22 May 23, 2019
run_dev initial commit Oct 27, 2018
run_prod initial commit Oct 27, 2018
test update to act-1.8.22 May 23, 2019

ActFramework Simple CRUD Service Demo

This application demonstrates how to write a simple CRUD service in ActFramework

Start the application

Start the application in dev mode

mvn clean compile act:run

Start the application in prod mode

mvn clean package
cd target/dist
tar xzf *.gz

Once application has been started, you can open browser and locate to http://localhost:5460 get the home page.

Run automate test

mvn clean compile act:test

This will start the application and run automate test scenarios and then shutdown the app. Normally you should add this to your CI pipeline.

Understanding the application

Application entry

The application starts with gallery.crud.AppEntry

public class AppEntry {
    public static void main(String[] args) throws Exception {

The main method call act.Act.start() method to bootstrap ActFramework and load this application.

The model class

There is one single model class defined to keep bookmark data:

@Entity(name = "bookmark")
public class Bookmark implements SimpleBean {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer id;

    public String name;

    public String url;


The data structure is simple, we have defined an id field, and name, url to keep track a bookmark.

The class implements SimpleBean, which allows we defined public fields instead of private field plus getter/setter, because ActFramework will enhance the class by generating getter/setter for the public fields defined in a SimpleBean typed class. It will also make sure a default constructor is defined in the class.

The service class

The service class BookmarkService provides CRUD service for Bookmark model:

public class BookmarkService extends SimpleRestfulServiceBase<Integer, Bookmark, JPADao<Integer, Bookmark>> {

We noticed there is no single request handler code defined in the service as all of the logic is defined in SimpleRestfulServiceBase provided with ActFramework. The only thing app needs to provide is the UrlContext of the service class, which will be used to dispatch the request to the service.


Question: Why do I get the following error message ?

Cannot encrypt/decrypt! Please download Java Crypto Extension pack from Oracle

Answer: Please download and install the JCE pack from Oracle for Java 8 or Java 7

You can’t perform that action at this time.