Since, Appengine was the best free java server to deploy application. This is why good to integrate java frameworks to google appengine.
As this point, assume that you already create your Google Appengine project. However if you don't know how to create GAE project go
here.
Pre-requisites:
* Eclipse Kepler + Spring 3.2.4 + Google App Engine 1.9.7 + Java 7
* Download Spring jars
Extract the zip files and copy jars to
war/WEB-INF/lib/(for deployment) and include the jars in project library.
1. Create
mv-dispacher-servlet.xml.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!--
Component
https://developers.google.com/appengine/articles/spring_optimization
-->
<!--
<context:component-scan base-package="com.winzter.springmvc.controllers">
<context:exclude-filter type="regex" expression="com.winzter.springmvc.controllers.GuessController.*" />
</context:component-scan>
-->
<!-- DEFINE Your bean Here -->
<bean class="com.winzter.springmvc.controllers.GuessController" />
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" />
<bean class="com.winzter.airgames.bigbarnword.controllers.FriendsController" />
<mvc:annotation-driven />
<!-- Bean to show you Di in GAE, via Spring, also init the MovieController -->
<bean class="com.winzter.springmvc.controllers.GuessController">
<property name="message">
<value>Hello World</value>
</property>
<!--constructor-arg name="message" value="Help ET go home" /-->
</bean>
<!-- bean class="com.winzter.airgames.bigbarnword.controllers.FriendsController">
<property name="message">
<value>Hello World</value>
</property>
</bean-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--
This serve for JSPs
Every controller menthod return string, it file /pages/string.jsp
-->
<property name="prefix">
<value>/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
2. Update/add code below to
web.xml
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>