Spring 4 MVC + JSONP Example
Spring 4 MVC + JSONP Example with REST, @ResponseBody and ResponseEntity
@ControllerAdvice public class JsonpAdvice extends AbstractJsonpResponseBodyAdvice { public JsonpAdvice() { super("callback"); } }
@Controller class BookController { @RequestMapping(value ="/book2", produces =MediaType.APPLICATION_JSON_VALUE ) @ResponseBody Book bookInfo2() { Book book = new Book(); book.setBookName("Ramcharitmanas"); book.setWriter("TulasiDas"); return book; } @RequestMapping(value ="/book3", produces =MediaType.APPLICATION_JSON_VALUE ) public ResponseEntity<Book> bookInfo3() { Book book = new Book(); book.setBookName("Ramayan"); book.setWriter("Valmiki"); return ResponseEntity.accepted().body(book); } }
相关推荐
fengchao000 2020-06-17
adonislu 2020-05-16
zmosquito 2020-05-10
adonislu 2020-05-10
somebodyoneday 2020-04-22
fengchao000 2020-04-22
fengchao000 2020-04-11
Richardxx 2020-03-07
somebodyoneday 2020-03-06
fengchao000 2020-03-05
somebodyoneday 2020-02-16
xiaouncle 2020-02-13
baijinswpu 2020-01-29
fengchao000 2020-01-10
fengchao000 2019-12-25
newthon 2019-12-23
somebodyoneday 2013-07-11