Tutorial66.com
@Share Application Development Skill.



Tutorial is tutorial...66 is My Country Code Up to 10 Years EXP for Application Development Role in Thailand.
collapse

Tutorial Category



Topic: Spring framework applicationcontext XML configuration Example  (Read 359 times)


My Development skill
Java JSP Servlet EJB
Spring Framework
Hibernate Framework
iReport Jasper Report
Apache CXF
PHP Codigniter
Oracle PLSQL
Unix Shell Script
About Me

I am Tao Up to 10 Years EXP for Application Development
Spring framework applicationcontext XML configuration Example
« on: October 21, 2011, 05:03:18 AM »
ApplicationContext is an Interface in Spring to Configuration for Bean Factory , Provide Resource ,MessageSource

Example ApplicationContext XML
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean id="configurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file:/EnterprisePT/conf.properties"/>
    </bean>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/jsp/" />
        <property name="suffix" value=".jsp" />
<property name="contentType" value="text/html; charset=UTF-8" />
    </bean>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref local="exampleInterceptor"/>
</list>
</property>
<property name="mappings">
<props>
<prop key="/example_insert.html">exampleController</prop>
<prop key="/example_load.html">exampleController</prop>
<prop key="/example_delete.html">exampleController</prop>
<prop key="/example_ws.html">exampleController</prop>
<prop key="/example_sap.html">exampleController</prop>
</props>
</property>
</bean>


<!-- ========================= CONTROLLER DEFINITIONS ========================= -->
<bean id="exampleController" class="com.en.controller.ExampleController">
<property name="methodNameResolver" ref="exampleControllerResolver"/>
<property name="model" ref="exampleModel"/>
<property name="defaultScreen" value="example"/>
</bean>
<bean id="exampleControllerResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
<property name="mappings">
<props>
<prop key="/example_insert.html">insertMethod</prop>
<prop key="/example_load.html">loadMethod</prop>
<prop key="/example_delete.html">deleteMethod</prop>
<prop key="/example_ws.html">callWS</prop>
<prop key="/example_sap.html">callSAP</prop>
  </props>
</property>
</bean>
<bean id="exampleModel" class="com.en.model.ExampleModel">
<property name="hibernateTemplate" ref="hibernateTemplate"/>
<property name="wsClient" ref="exampleWSClient"/>
<property name="sap" ref="exampleSAP"/>
</bean>

<bean id="exampleInterceptor" class="com.en.interceptor.ExampleInterceptor" />
<bean id="exampleWSClient" class="com.en.ws.client.ExampleWSClient">
<property name="endpoint" value="http://127.0.0.1:8080/EnterPrisePT/ws/example"/>
</bean>
<bean id="exampleSAP" class="com.en.sap.ExampleSAP" />


</beans>

Need more details Reply this topic  ;D


My Development skill
Java JSP Servlet EJB
Spring Framework
Hibernate Framework
iReport Jasper Report
Apache CXF
PHP Codigniter
Oracle PLSQL
Unix Shell Script
About Me

I am Tao Up to 10 Years EXP for Application Development
Re: Spring framework applicationcontext XML configuration Example
« Reply #1 on: October 21, 2011, 07:04:54 AM »
Hi guy .. How can i Load Application Context and test is in java client.. not on container .




SimplePortal 2.3.3 © 2008-2010, SimplePortal