Does Google App Engine support Spring @RestController

105 views
Skip to first unread message

Anders Vincent Lund

unread,
Oct 20, 2016, 11:07:57 AM10/20/16
to Google App Engine

I would like to try out Google App Engine. I have an application written in Spring MVC. My controllers look like this:



@RestController
@RequestMapping("/something")
public class Controller{

@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
@Override
public void add(@RequestBody Input input) {
// dostuff
}
}


Is this possible to deploy on Google App Engine? I would really really like to avoid loosing this great abstraction and go back to stuff like this:

public void doGet(HttpServletRequest req, HttpServletResponse resp)
Is that possible or do I have to look at another hosting service?

Jordan (Cloud Platform Support)

unread,
Oct 21, 2016, 4:03:01 PM10/21/16
to Google App Engine
As explained in the Spring documentation, @RestController is shorthand for @Controller and @ResponseBody rolled together. Since both @Controller and @ResponseBody are supported in the App Engine environment, the new Spring 4 @RestController should work as well. If you do receive errors, you can always revert back to using @Controller and @ResponseBody as an alternative. 

You can view our guide on optimizing the Spring Framework for App Engine, as well as the Mkyong guide for RESTful Spring on App Engine. If you experience any further issues after performing the above, you can provide details about your setup and stack trace to Stack Overflow. Google groups is intended for general discussions rather than 1-on-1 support assistance. You can see our Community Support [1] page for a list of the tags we monitor.

Before posting a question to Stack Overflow it's a good idea to read over the guidelines at 'How do I ask a good question' [2].

Reply all
Reply to author
Forward
0 new messages