Java Reference
In-Depth Information
Listing 6-21. applicationContext.xml
1. <?xml version="1.0" encoding="UTF-8"?>
2. <beans xmlns=" http://www.springframework.org/schema/beans "
3. xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "
xmlns:context=" http://www.springframework.org/schema/context "
4. xmlns:aop=" http://www.springframework.org/schema/aop "
5. xsi:schemaLocation=" http://www.springframework.org/schema/beans
6. http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
7. http://www.springframework.org/schema/context
8. http://www.springframework.org/schema/context/spring-context-3.2.xsd
9. http://www.springframework.org/schema/aop
10. http://www.springframework.org/schema/aop/spring-aop-3.2.xsd " >
11.
12. <!-- telling container to take care of annotations stuff -->
13. <context:annotation-config />
14.
15. <!-- declaring base package -->
16. <context:component-scan base-package="com.apress.books" />
17.
18. <bean id="bookController" class="com.apress.books.controller.BookController">
19. <property name="bookService" ref="service"></property>
20. </bean>
21.
22. <bean id="dao" class="com.apress.books.dao.BookDAOImpl" >
23. <property name="dataSource" ref="dataSourceBean">
24. </property>
25. </bean>
26.
27. <bean id="service" class="com.apress.books.service.BookServiceImpl">
28. <property name="bookDao" ref="dao">
29. </property>
30. </bean>
31.
32. <bean id="dataSourceBean"
33. class="org.springframework.jdbc.datasource.DriverManagerDataSource">
34. <property name="driverClassName" value="com.mysql.jdbc.Driver" />
35. <property name="url" value="jdbc:mysql://localhost:3306/books" />
36. <property name="username" value="root" />
37. <property name="password" value="password" />
38. </bean>
39. </beans>
Lines 18 to 20 : Configures bookController with bookService
Developing Templates
You will reuse the template and the template client file developed earlier for the header and
sidebar of the bookstore application. However, you need to modify sideBar.xhtml to invoke the
listOfAllBooks action in the bookController bean, as illustrated in Listing 6-22.
 
Search WWH ::




Custom Search