Mars-cloud 3.0.6 released

The updates are as follows:

cloud interface returned data, previously only supported json, now it supports any type of (the need to support serialization)

Rest call

返回类型 result = MarsRestTemplate.request(服务name,controller接口方法名,参数对象,返回类型.class);

Feign call

To build a common class java
class MarsFeign top with annotations, see the following specific examples:


import com.mars.cloud.core.annotations.MarsFeign;
import com.test.entity.DemoEntity;

/* 
这个注解的serverName跟你要调用的那个服务的name一致(yml文件里cloud配置的name) 
beanName 不写的话,默认为类名首字母小写
*/
@MarsFeign(serverName="mars-demo",beanName="demoFeign")
public interface DemoFeign {
    /* 
        这里面的所有方法,跟你要调用的那个API中的方法名一致 
        方法的参数只能传一个或者不传,且参数必须是可序列化的
    */
    返回类型 insert(DemoEntity entity);

    返回类型 selectList(DemoEntity entity);
}

This object is injected inside your MarsBean

@MarsBean("testService")
public class TestService {

    @MarsWrite("demoFeign")
    private DemoFeign demoFeign;
}

Then you can directly call inside the method

Official website: http://mars-framework.com/

Guess you like

Origin www.oschina.net/news/111746/mars-cloud-3-0-6-released