how about one resource file has two different methods both annotated with @Post

Created by Wang, Jerry, last modified on Jul 28, 2016

how about one resource file has two different methods both annotated with @Post

测试结果:只有第一个method add 的参数Advertisement的构造函数会被call到。框架检测到这种duplicate情况,报了一个warning:
2016-07-28 14:44:14,420 WARN [http-bio-9098-exec-6] - [org.apache.cxf.jaxrs.utils.JAXRSUtils] [] - Both com.sap.bulletinboard.ads.resources.AdvertisementResource#addJS and com.sap.bulletinboard.ads.resources.AdvertisementResource#add are equal candidates for handling the current request which can lead to unpredictable results
Advertisement constructor
Advertisement setter called: scala3
把add的@POST去掉,再执行post,得到期望的第二个方法JavaScript 构造函数被调用:

how about one resource file has two different methods both annotated with @Post

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
how about one resource file has two different methods both annotated with @Post