Comments (10)
With SnackSerializer it seems to work but i have a problem when both method in interface have the same name. Then i get a "java.lang.IllegalArgumentException: argument type mismatch" because i guess he is calling the first method with a list instead of calling the second method.
example
@Mapping(value = "/helloService", method = MethodType.SOCKET)
@Remoting
public class HelloServiceImpl implements HelloService {
public String hello(String name) {
return "hello " + name;
}
public String hello(List<User> users) {
return "" + users.size();
}
}
from solon.
因为资料不全,给你带来不便,非常抱歉。
from solon.
需要把:
solon.serialization.jackson
nami.coder.jackson
换成:
solon.serialization.snack3
nami.coder.snack3
//jackson 目前适配得还不是很好
from solon.
或者换成:
solon.serialization.fastjson
nami.coder.fastjson
//目前 jackson 的编码适配,只适用于非泛型的 //我个人对它不是很熟,所以适配差了点儿
from solon.
支持序列化方案
通道 | 说明 |
---|---|
Form | 表单模式 |
Json | 适配有:snack3、fastjson (推荐) |
Hessian 通道 | 适配有:hessian (推荐) |
Protostuff 通道 | 适配有:protostuff |
from solon.
//使用Nami构建,指定编码器
HelloService rpc = Nami.builder().url("tcp://localhost:28080/demoe/rpc")
.encoder(SnackTypeEncoder.instance)
.create(HelloService.class);
具体看下官网的优化过的文章:http://solon.noear.org/article/67
from solon.
杰克逊允许通过以下代码将jsonArray绑定到列表中
ObjectMapper mapper = new ObjectMapper()
List<Person> personList = mapper.readValue(jsonString, new TypeReference<List<Person>>() {});
如果我理解,我不应该使用jackson,而应该使用Snack3,对吗?但是我需要在我的项目中忽略一些字段。在Snack3中是否有与@JsonIgnore相当的东西?
谢谢你的帮助 !
from solon.
Snack3 有两种方式可以控制相同效果:
- @ONodeAttr 注解
- transient 关键字
from solon.
List<Person> personList = mapper.readValue(jsonString, new TypeReference<List<Person>>() {});
//这种特性snack3也支持的
List<Person> personList = ONode.deserialize(jsonString, (new ArrayList<Person>(){}).getClass());
//或者
List<Person> personList = ONode.deserialize(jsonString, new TypeRef<List<Person>>(){}.getType());
from solon.
Thank you very much !
from solon.
Related Issues (20)
- 希望升级一下第三方库的依赖 HOT 4
- 任务发放:优化 onMissingBean 条件与 List[Bean] 注入的边界问题 HOT 2
- 同时有 queryString 和 from-data 参数时,Controller 方法中的参数无法正确注入 HOT 4
- 建议官网RPC未来支持高性能序列化框架-flatbuffers和simple-binary-encoding HOT 1
- Solon 框架可以增加Javalin容器支持 HOT 2
- 建议Solon 未来可以支持物联网MQTT协议 HOT 2
- 新增组件 Solon Cloud SnailJob HOT 2
- 申明:Solon 的社区活动主要在 GitEE(欢迎参与)
- 【任务发放】把 solon.test 里带的 HttpUtils 改为基于 smart-http 适配
- 【任务发放】添加 Solon Auth Server 模块
- 【任务发放】添加“@Destroy”注解支持 HOT 1
- 希望插件按需加载 HOT 2
- 希望增加热部署 HOT 5
- IOC包扫描时排队某些包 HOT 3
- 【任务发放】优化 List[Bean] 注入,支持排序 HOT 1
- 【任务发放】增加 @NamiService 注解,替代 @Remoting 注解(让 Nami 成为前后配套服务) HOT 1
- 建议未来nami RPC 支持-Aeron 协议、低延迟RPC
- 后扫描的包,依赖注入List对象为空 HOT 1
- 安卓中运行solon,发现bug HOT 6
- lettuce-solon-plugin native编译出来的包,无法注入配置 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solon.