|
From: Ken K. <kk...@kk...> - 2003-05-20 12:35:13
|
Thomas, Thanks again for your help. I have already made the same changes in my=20 own latest working version as you describe in 1. I very much wanted to=20 retain the "dataSource" bean because it does show how easy it is to=20 switch datasources. The value of this will become even more apparent=20 when I have refactored to separate the persistence code from the=20 business logic. Ken tri...@tr... wrote: >To All, > >I went back to modify Ken's demo app to use J=FCrgen's JndiDataSourceBea= n and to >run with the latest version of the framework code from CVS. > >Again, I had to make just a few changes, but this time I did not touch a= ny of >Ken's original Java code. I only modified three of the deployment xml f= iles.=20 >This really shows how valuable a well designed framework is. > >These are the changes I made to the original code from Ken's Petclinic1.= zip >(Steps 2, 3 and 6 are the same as last time): > >1. Removed the <servlet> entry for ContextLoaderServlet from web.xml. T= his >class has recently been removed from CVS. Replaced it with a <listener>= entry. > > <listener> > =20 ><listener-class>com.interface21.web.context.ContextLoaderListener</liste= ner-class> > </listener> > > >2. Added a 'resource-ref' entry to web.xml. It goes at the end after >the <taglib> entries. > > <resource-ref> > <description>The default DS</description> > <res-ref-name>jdbc/SpringDS</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > >3. Created a jboss-web.xml file with the corresponding 'resource-ref' >entry pointing to the HSQL default datasource. > ><jboss-web> > <resource-ref> > <res-ref-name>jdbc/SpringDS</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <jndi-name>java:/DefaultDS</jndi-name> > </resource-ref> ></jboss-web> > > >4. Changed the "bean" entry for "dataSource" in the >applicationContext.xml - it now uses the new JndiDataSourceBean. > ><beans> =09 > > <!-- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D--> > <!-- Global Message source. For all servlets. --> > <!-- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D--> > <bean name=3D"messageSource" >class=3D"com.interface21.context.support.ResourceBundleMessageSource">=09 > <property name=3D"basename">messages</property> =09 > </bean> > > <bean name=3D"dataSource" >class=3D"com.interface21.jdbc.datasource.JndiDataSourceBean" > > <property name=3D"name">jdbc/SpringDS</property> > </bean> > =20 ></beans> > > >5. Replaced the WEB-INF/lib/spring-full-0.8.jar with the latest version. > > >6. Created a "petclinic.war" directory under the >"c:\jboss-3.2.1\server\default\deploy" directory and deployed the applic= ation there. > > >That's it for this time. > >I have attached a zip file with the changed xml files. > > >--Thomas > > =20 > |