Set JSON provider at RESTEasy on JBoss 7.1.1

前端 未结 4 1335
执念已碎
执念已碎 2021-02-15 17:26

How could I set JSON provider for RestEasy at JBoss 7.1.1?

RestEasy documentation says:

RESTEasy allows you to marshall JAXB annotated POJOs to an

4条回答
  •  萌比男神i
    2021-02-15 17:58

    From what I observed right now, Jackson is the default in JBoss AS 7.1.2.

    First, the RestEasy modules are hidden from app's classloader, which IMO should not be. So I just filed https://issues.jboss.org/browse/AS7-5605 .

    Second, to your question: To set the particular provider, you need to remove it from classloader's spot in AS - so again, to go module.xml's and comment out those providers which you don't want to use - if Jackson is available, RestEasy uses it; otherwise it uses Jettison.

    Also, add them your project as a compile time dependency, so you can use their specific annotations. Example:

        
        
            org.jboss.resteasy
            jaxrs-api
            2.3.4.Final
            provided
        
        
            org.codehaus.jackson
            jackson-core-asl
            1.9.2
            provided
        
    

    Note: Until AS7-5605 is done, you need to set the versions manually. After (in later versions of AS), you have to remove these versions and use those defined in JBoss BOM. See JBoss AS QuckStarts for example.

    Feel free to create and contribute a QuickStart of RestEasy using alternative provider.

提交回复
热议问题