# Mars
**Repository Path**: yuchangxing/Mars
## Basic Information
- **Project Name**: Mars
- **Description**: 声明式API编程(DAP) 框架,10秒钟就可以建立一个后端服务接口,我们甚至没有Controller的概念【本机测试,响应时间最低可达9毫秒,吐吞量最高可达1200】
- **Primary Language**: Java
- **License**: MIT
- **Default Branch**: master
- **Homepage**: http://mars-framework.com
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 40
- **Created**: 2020-02-13
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
Declarative API programming (DAP) framework
[Mars-start Source (launcher)](https://github.com/yuyenews/Mars-start),
[Mars-cloud Source (distributed middleware)](https://github.com/yuyenews/Mars-cloud)
## Declarative API programming (DAP)
According to the traditional development method, if you want to develop a back-end interface, you need to divide into the following three steps
1. Create controller
2. Create a service
3. Create dao (and even create xml to store sql)
However, when we write an interface, the focus should be on business logic, which means that our focus should be on the second step, but usually the repeated workload of the first and third steps suffocates us, so I Arranged a bit, formulated a new development method, this new set of development methods is called a declarative API
1. Write business logic
2. Declare an API to the front end
3. Associate API with business logic
So we play like this
## Write business logic
interface
```
public interface TestService {
selectList(TestDTO testDTO);
}
```
Implementation class
```
@MarsBean("testService")
public class TestServiceImpl implements TestService{
selectList(TestDTO testDTO){
// Writing business logic
return data(Just return directly, it will automatically become json);
}
}
```
## Add two annotations to the super interface of Service
```
@MarsApi
public interface TestService {
@MarsReference(beanName = "testService")
selectList(TestDTO testDTO);
}
```
At the core of this set of ideas is to treat the back end as a separate entity and completely separate it from the front end.Back-end write back-end business logic. If the front end needs data, then we declare an interface
## What to do next
Seeing this, everyone will definitely have questions, how to call the api on the front end, and how to operate the database on the back end? This requires you to move your fingers and check out my official website
## What else can i do
First, the declarative API is a change to the front-end and back-end interaction methods, eliminating the need for a Controller.
In fact, this style is very common in microservices, such as Dubbo's api,
Since the microservice interface can use interface to provide external services, we can also use it on the http interface.
In addition to the declarative API, we also provide the following features
1. Single table operation and fixed sql operation, only one line of annotation is required
2. Paging only needs to call one method, without any third-party dependencies
3. Distributed lock requires only one line of annotations
3. No sqlMapper.xml like Mybatis
4. Support AOP, IOC, declarative transactions
## Official website
[http://mars-framework.com](http://mars-framework.com)
## Donation sponsorship
[](https://ko-fi.com/G2G517AIY)
[Go to the official website to sponsor](http://mars-framework.com/sponsor.html)