Sample of applicationContext.xml file in java?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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
">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>WEB-INF/classes/config/database/db.properties</value>
</property>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="loginBo" class="testlab.bo.impl.LoginBoImpl" >
<property name="loginDao" ref="loginDao" />
</bean>
<bean id="loginDao" class="testlab.dao.impl.LoginDaoImpl" >
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>
<!-- Begin for Test Declaration-->
<bean id="testDetailBo" class="testlab.bo.impl.TestDetailBoImpl" >
<property name="testDetailDao" ref="testDetailDao" />
</bean>
<bean id="testDetailDao" class="testlab.dao.impl.TestDetailDaoImpl" >
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>
<!-- End for Test Declartion-->
<!-- Begin for Admin Declaration-->
<bean id="adminBo" class="testlab.bo.impl.AdminBoImpl" >
<property name="adminDao" ref="adminDao" />
</bean>
<bean id="adminDao" class="testlab.dao.impl.AdminDaoImpl" >
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>
<!-- End for Admin Declartion-->
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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
">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>WEB-INF/classes/config/database/db.properties</value>
</property>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="loginBo" class="testlab.bo.impl.LoginBoImpl" >
<property name="loginDao" ref="loginDao" />
</bean>
<bean id="loginDao" class="testlab.dao.impl.LoginDaoImpl" >
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>
<!-- Begin for Test Declaration-->
<bean id="testDetailBo" class="testlab.bo.impl.TestDetailBoImpl" >
<property name="testDetailDao" ref="testDetailDao" />
</bean>
<bean id="testDetailDao" class="testlab.dao.impl.TestDetailDaoImpl" >
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>
<!-- End for Test Declartion-->
<!-- Begin for Admin Declaration-->
<bean id="adminBo" class="testlab.bo.impl.AdminBoImpl" >
<property name="adminDao" ref="adminDao" />
</bean>
<bean id="adminDao" class="testlab.dao.impl.AdminDaoImpl" >
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>
<!-- End for Admin Declartion-->
</beans>
No comments:
Post a Comment