sunraysweb-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc"
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/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!--Enables MVC annotations including input validation tags -->
<mvc:annotation-driven />
<!-- Discovers Spring components -->
<context:component-scan base-package="in.co.sunrays" />
<!-- View Resolvers -->
<!-- Configure Tiles -->
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles.xml</value>
</list>
</property>
</bean>
<!-- Tiles View resolver will be called in Order 1 after calling InternalResourceViewResolver -->
<bean id="tilesViewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.tiles2.TilesView
</value>
</property>
<property name="order" value="1" />
</bean>
<!-- The InternalResourceViewResolver will be defined to resolve the view
names. As per the above defined rule, a logical view named "login" is delegated
to a view implementation located at /WEB-INF/pages/login.jsp . It will be
called in order 2 after tiles View resolver -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
<property name="order" value="2" />
</bean>
<!-- Enable interceptors -->
<mvc:interceptors>
<!-- Front Controller -->
<mvc:interceptor>
<mvc:mapping path="/*" />
<bean class="in.co.sunrays.ctl.FrontCtlInt" />
</mvc:interceptor>
<mvc:interceptor>
<mvc:mapping path="/UrlMapping/*" />
<bean class="in.co.sunrays.ctl.TimeLoggerInt" />
</mvc:interceptor>
<!--Intercepts i18n request -->
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
</bean>
</mvc:interceptors>
<!-- Configuring Internationalization (i18n) / Localization (L10n) -->
<!-- define the message resources. -->
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
<!-- Stores User locale in session and remember for subsequent requests -->
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="en" />
</bean>
<!-- Database connection pool -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/ST_JAVA" />
<property name="username" value="root" />
<property name="password" value="" />
</bean>
<bean id="dataSourceC3P0" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/ST_JAVA" />
<property name="user" value="root" />
<property name="password" value="" />
<!-- these are C3P0 properties -->
<property name="acquireIncrement" value="5" />
<property name="minPoolSize" value="1" />
<property name="maxPoolSize" value="2" />
<property name="maxIdleTime" value="60" />
</bean>
<!-- Hibernate Configuration -->
<!-- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSourceC3P0" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="mappingResources">
<list>
</list>
</property>
<property name="annotatedClasses">
<list>
<value>in.co.sunrays.dto.CollegeDTO</value>
<value>in.co.sunrays.dto.MarksheetDTO</value>
</list>
</property>
</bean>
<!-- Hibernate Transaction Manager -->
<bean id="hibTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="hibTransactionManager" />
</beans>