- 2017-3-9 ACT 1.0.0 发布到 Maven 中央库
- 当前稳定版本: 1.0.0
将下面的依赖添加进你的 pom.xml 文件
<dependency>
<groupId>org.actframework</groupId>
<artifactId>act</artifactId>
<version>[1.0.0, 2.0.0)</version>
</dependency>如果需要使用快照版发行,您还需要在 pom.xml 文件中加入下面的代码:
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>-
全栈式框架
- Actframework 不是一个 servlet 框架。Act 应用不需要 servlet 容器,而是作为一个独立的 Java 应用程序运行。一般可以在数秒之内启动
-
无与伦比的开发体验与卓越性能
- 一旦开始开发就无需重启服务器,Act 的 dev 模式提供的热加载功能是每个 Java 开发员的梦想。看看这个三分钟的视频演示来体验一下把!
- 这个第三方性能测试展示了 Act 的强劲性能 在简单的情况下 Act 可以获得 Spring-Boot 20倍以上的吞吐量
-
完整的 JSR330 依赖注入支持
-
强大的单页/移动应用开发支持
- RESTful 支持
- 内置 CORS 支持
- 当不能使用 Cookie 的情况下,ActFramework 提供了 Session/HTTP Header 映射
-
必须的安全性
- 回话 Cookie 设置为 Http Only,Secure(当运行在 HTTPS 上面时),框架通过将 Cookie 内容签名并加密(可选)来防止 Cookie 篡改
- 只需一行配置即可启用 CSRF 保护
- XSS 防范: 缺省的 Rythm 模板引擎自动将变量输出转码
- 采用 AAA plugin 实现认证/授权/记账机制
-
Annotation aware but not annotation stack
-
Annotation is one of the tool ActFramework used to increase expressiveness. However we do not appreciate crazy annotation stacked code. Instead we make the code to express the intention in a natural way and save the use of annotation whenever possible.
For example, for the following SpringMVC code:
@RequestMapping(value="/user/{userId}/invoices", method = RequestMethod.GET) public List listUsersInvoices( @PathVariable("userId") int user, @RequestParam(value = "date", required = false) Date dateOrNull) { ... }
The corresponding ActFramework app code is:
@GetAction("/user/{user}/invoices") public List listUsersInvoices(int user, Date date) { ... }
-
-
Multi-environment configuration
-
ActFramework supports the concept of
profilewhich allows you to organize your configurations in different environment (defined by profile) easily. Take a look at the following configurations from one of our real project:resources ├── conf │ ├── common │ │ ├── app.properties │ │ ├── db.properties │ │ ├── mail.properties │ │ ├── payment.properties │ │ └── social.properties │ ├── local-no-ui │ │ ├── app.properties │ │ ├── db.properties │ │ └── port.properties │ ├── local-sit │ │ └── app.properties │ ├── local-ui │ │ ├── app.properties │ │ └── db.properties │ ├── sit │ │ ├── app.properties │ │ └── db.properties │ └── uat ...Suppose on your UAT server, you start the application with JVM option
-Dprofile=uat, ActFramework will load the configuration in the following sequence:- Read all
.propertiesfiles in the/resources/conf/commondir - Read all
.propertiesfiles in the/resources/conf/uatdir
This way ActFramework use the configuration items defined in
uatprofile to overwrite the same items defined incommonprofile. The common items that are not overwritten still effective. - Read all
-
-
Powerful view architecture with multiple render engine support
-
Commonly used tools
package demo.helloworld;
import act.Act;
import act.Version;
import org.osgl.mvc.annotation.GetAction;
public class HelloWorldApp {
@GetAction
public String sayHello() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
Act.start("Hello World", Version.appVersion(), HelloWorldApp.class);
}
}See this 7 mins video on how to create HelloWorld in Eclipse from scratch. or for users without youtube access
package demo.rest;
import act.controller.Controller;
import act.db.morphia.MorphiaAdaptiveRecord;
import act.db.morphia.MorphiaDao;
import org.mongodb.morphia.annotations.Entity;
import org.osgl.mvc.annotation.*;
import java.util.Map;
import static act.controller.Controller.Util.notFoundIfNull;
@Entity("user")
public class User extends MorphiaAdaptiveRecord<User> {
@Controller("user")
public static class Service extends MorphiaDao<User> {
@PostAction
public User create(User user) {
return save(user);
}
@GetAction
public Iterable<User> list() {
return findAll();
}
@GetAction("{id}")
public User show(String id, Map<String, Object> data) {
return findById(id);
}
@PutAction("{id}")
public User update(String id, Map<String, Object> data) {
User user = findById(id);
notFoundIfNull(user);
user.mergeValues(data);
return save(user);
}
@DeleteAction("{id}")
public void delete(String id) {
deleteById(id);
}
}
public static void main(String[] args) throws Exception {
Act.start("RESTful Demo", Version.appVersion(), User.class);
}
}See this 1 hour video on RESTful support or for user without youtube access
See this 7 mins video to understand more about AdaptiveRecord or for user without youtube access
I love PlayFramework v1.x because it is simple, clear and expressive. It brought us a completely different experience in web development with Java. However I don't totally agree with where Play 2.X is heading for, and it looks like I am not the only person with the concern as per this open letter to Play Framework Developers.
I have thought of rolling out something that could follow the road paved by Play 1.x, something that is simple, clear, expressive and Java (specifically) developer friendly. About one and half year after that I decide I could start the project seriously, and now another one and half year passed by, I've got this ACT framework in a relatively good shape.
Happy coding!