gstackoverflow
gstackoverflow

Reputation: 37078

how select viewResolver implicitly

I use spring mvc

I have controller for rest web service

Sometimes I want to returns xml, Sometimes - json. In classPath I have and jackson and jaxb

How I can switch between them?

Upvotes: 0

Views: 67

Answers (2)

dimoniy
dimoniy

Reputation: 5995

You'll need ContentNegotiatingViewResolver. Please check Spring documentation on the matter especially the Returning multiple representations section.

Upvotes: 0

Related Questions