Advertisement
Guest User

Untitled

a guest
Oct 17th, 2016
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  2. <property name="driverClassName">
  3. <value>com.mysql.jdbc.Driver</value>
  4. </property>
  5. <property name="url">
  6. <value>jdbc:mysql://x.x.x.x:3306/app
  7. </value>
  8. </property>
  9. <property name="username">
  10. <value>user1</value>
  11. </property>
  12. <property name="password">
  13. <value>pass1</value>
  14. </property>
  15. </bean>
  16.  
  17. if [ $# -ne 2 ];then
  18. echo "usage: argument 1:username 2:password"
  19. exit 1
  20. fi
  21. USERNAME=$1
  22. PASSWORD=$2
  23.  
  24.  
  25. echo "Change values in config.xml..."
  26.  
  27. cat <<EOF >test.xml
  28. <bean id="dataSource"
  29. class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  30. <property name="driverClassName">
  31. <value>com.mysql.jdbc.Driver</value>
  32. </property>
  33. <property name="url">
  34. <value>jdbc:mysql://x.x.x.x:3306/app
  35. </value>
  36. </property>
  37. <property name="username">
  38. <value>${USERNAME}</value>
  39. </property>
  40. <property name="password">
  41. <value>${PASSWORD}</value>
  42. </property>
  43. </bean>
  44.  
  45. EOF
  46. echo "Done."
  47.  
  48. xmlstarlet ed --inplace
  49. -u "//bean[@id='dataSource']//property[@name='password']/value"
  50. -v 'new_pass' source.xml
  51.  
  52. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  53. <property name="driverClassName">
  54. <value>com.mysql.jdbc.Driver</value>
  55. </property>
  56. <property name="url">
  57. <value>jdbc:mysql://x.x.x.x:3306/app
  58. </value>
  59. </property>
  60. <property name="username">
  61. <value>user1</value>
  62. </property>
  63. <property name="password">
  64. <value>pass1</value>
  65. </property>
  66. </bean>
  67.  
  68. <?xml version="1.0"?>
  69. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  70. <property name="driverClassName">
  71. <value>com.mysql.jdbc.Driver</value>
  72. </property>
  73. <property name="url">
  74. <value>jdbc:mysql://x.x.x.x:3306/app
  75. </value>
  76. </property>
  77. <property name="username">
  78. <value>user1</value>
  79. </property>
  80. <property name="password">
  81. <value>new_pass</value>
  82. </property>
  83. </bean>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement