Spring Beans configuration for Url mappings in spring, property file configuration, Tiles integration, Data source configuration, Property configuration, Cache configuration, property file configuration in spring
property file configuration in spring
=====================================
<beans>
<bean id="messageSource"class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>propertyfilename</value>
</list>
</property>
</bean>
Url mappings in spring:
==========================================================
<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/abc.do">loginController</prop>
</props>
</property>
</bean>
Loads the all business configuration files:(web.xml configuration)
===================================================================
<context-param>
<param-name>parentContextKey</param-name>
<param-value>businessLayerContext</param-value>
</context-param>
<context-param>
<param-name>locatorFactorySelector</param-name>
<param-value>classpath*:businessLayerContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
Tiles integration with spring:
=============================================================
<beans>
<!-- Configures the tiles defintions file -->
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tile/tiles-def.xml</value>
</list>
</property>
</bean>
<!-- view mappings from localized classpath files -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.tiles.TilesJstlView
</value>
</property>
</bean>
</beans>
Data source configuration
==============================================================
<beans>
<!-- Bean to create Data Source -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>${ds.driverClassName}</value>
</property>
<property name="url">
<value>${ds.url}</value>
</property>
<property name="username">
<value>${ds.username}</value>
</property>
<property name="password">
<value>${ds.password}</value>
</property>
<property name="accessToUnderlyingConnectionAllowed">
<value>true</value>
</property>
<property name="initialSize">
<value>3</value>
</property>
<property name="maxActive">
<value>5</value>
</property>
<property name="maxIdle">
<value>5</value>
</property>
<property name="minIdle">
<value>1</value>
</property>
<property name="maxWait">
<value>-1</value>
</property>
<property name="poolPreparedStatements">
<value>true</value>
</property>
<property name="maxOpenPreparedStatements">
<value>10</value>
</property>
<!-- Remove the adandoned connections -->
<property name="removeAbandoned">
<value>true</value>
</property>
<property name="removeAbandonedTimeout">
<value>100</value>
</property>
<property name="logAbandoned">
<value>true</value>
</property>
<property name="validationQuery">
<value>Select 1 from dual</value>
</property>
<property name="testOnBorrow">
<value>true</value>
</property>
</bean>
Property configurator:
============================================================
<!-- Externalizing the dataSource properties from defaultLocal.properties -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyOverrideConfigurer">
<property name="location">
<value>classpath:projectspecic_file.properties</value>
</property>
</bean>
Cache configuration:
==============================================================
<beans>
<!-- EHCache's CacheManager -->
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
singleton="true">
<property name="configLocation">
<value>classpath:ehcache.xml</value>
</property>
</bean>
<!-- EhCache Used by SourceConfig -->
<bean id="configEhCache"
class="org.springframework.cache.ehcache.EhCacheFactoryBean"
singleton="true">
<property name="cacheManager">
<ref local="cacheManager" />
</property>
<property name="cacheName">
<value>CONFIG_CACHE</value>
</property>
</bean>
<bean id="configCache" class="com.cache.Cache"
singleton="true">
<property name="cache">
<ref local="configEhCache" />
</property>
</bean>
</beans>
Business Layer context files configuration:
===============================================================
<beans>
<bean id="businessLayerContext"
class="org.springframework.context.support.ClassPathXmlApplicationContext"
abstract="false" singleton="true" lazy-init="default"
autowire="default" dependency-check="default">
<constructor-arg>
<list>
<value>businessCtxt-security.xml</value>
</list>
</constructor-arg>
</bean>
</beans>
No comments:
Post a Comment