Advertisement
Guest User

Untitled

a guest
Oct 14th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  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"
  4. xsi:schemaLocation = "http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd ">
  6.  
  7. <!-- <bean/> definitions here -->
  8. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> // зависимость - конкретная реализация DataSourse c некоторыми настройками
  9. <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  10. <property name="url" value="jdbc:mysql://localhost:3306/"/>
  11. <property name="username" value="root"/>
  12. <property name="password" value="root"/>
  13. <property name="maxActive" value="10"/>
  14. <property name="maxIdle" value="5"/>
  15. <property name="minIdle" value="1"/>
  16. <property name="poolPreparedStatements" value="true"/>
  17. <property name="initialSize" value="1"/>
  18. </bean>
  19. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  20. <property name="dataSource" ref="dataSource"/> //тут внедрение зависимости через сеттер: setDataSource(и объект с настройками выше)
  21. </bean>
  22. <bean id="userDAO" class="ua.khpi.karnaukh.Lab1.dao.implementations.UserDAOImpl">
  23. <constructor-arg ref="transactionManager"/>
  24. <property name="transactionManager" ref="transactionManager"/> //тут внедряю зависимость в свой класс
  25. </bean>
  26. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement