简体   繁体   English

使用xml配置球衣RESTFUL

[英]Configure jersey RESTFUL using xml

I would like to ask you about RESTFUL with jersey api;whenever we are doing annotaion based configuration in spring for example of its Aspects we can use Annotation or xml based configuration. 我想向您询问有关jersey API的RESTFUL的信息;无论何时我们在春季进行基于注释的配置(例如其方面)时,都可以使用基于注释或基于xml的配置。

@Aspect in class 

or 要么

<aop:aspect></aop:aspect> in xml

Is there any option available like this in RESTFUL with jersey api with seperate xml? RESTFUL with jersey api和单独xml的RESTFUL with jersey api是否有可用的这样的选项?

@Path("/hello")
public class RestHelloWorld { 
 @GET
 @Produces(MediaType.TEXT_PLAIN)
 // method
}

to

some xml configuration for these path,method and other annotations. 这些路径,方法和其他注释的一些xml配置。

Well, Jersey is an implementation of JAX-RS , so looking at the JAX-RS specification (downloadable here ) first, there is no mention of any XML configuration mechanism. 好吧,Jersey是JAX-RS的实现,因此首先看一下JAX-RS规范(可在此处下载),这里没有提到任何XML配置机制。 Instead the specification clearly states that it is POJO-based : 相反,规范明确指出它是基于POJO的

The API will provide a set of annotations and associated classes/interfaces that may be used with POJOs in order to expose them as Web resources. 该API将提供一组注释以及与POJO一起使用的相关类/接口,以便将它们公开为Web资源。 The specification will define object lifecycle and scope. 该规范将定义对象的生命周期和范围。

Reading through the Jersey user guide , it seems that Jersey (as expected) does not add on an XML configuration mechanism of its own. 通读Jersey用户指南 ,Jersey(如预期的那样)似乎并没有添加自己的XML配置机制。

So, it looks like it's going to be annotations all the way. 因此,看起来它将一直是注释。 In general, it seems that as far as JavaEE is concerned, XML configuration mechanisms are slowly going the way of the dodo. 通常,就JavaEE而言,XML配置机制似乎正在逐渐发展到dodo的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM