How don't duplicate the dataSource in Spring xml files?



I have two files which contain the dataSource definitions. There are /WEB-INF/applicationContext.xml and src/main/resources/hibernateContext.xml


it's my dataSource definition:



<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close"
p:driverClassName="com.mysql.jdbc.Driver"
p:url="jdbc:mysql://localhost/fullproject"
p:username="root"
p:password="admin" />


This definition is necessary in every file for using with different services; Can i don't duplicate this code and only definite it only in one place????


No comments:

Post a Comment