Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName">
- <value>com.mysql.jdbc.Driver</value>
- </property>
- <property name="url">
- <value>jdbc:mysql://x.x.x.x:3306/app
- </value>
- </property>
- <property name="username">
- <value>user1</value>
- </property>
- <property name="password">
- <value>pass1</value>
- </property>
- </bean>
- if [ $# -ne 2 ];then
- echo "usage: argument 1:username 2:password"
- exit 1
- fi
- USERNAME=$1
- PASSWORD=$2
- echo "Change values in config.xml..."
- cat <<EOF >test.xml
- <bean id="dataSource"
- class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName">
- <value>com.mysql.jdbc.Driver</value>
- </property>
- <property name="url">
- <value>jdbc:mysql://x.x.x.x:3306/app
- </value>
- </property>
- <property name="username">
- <value>${USERNAME}</value>
- </property>
- <property name="password">
- <value>${PASSWORD}</value>
- </property>
- </bean>
- EOF
- echo "Done."
- xmlstarlet ed --inplace
- -u "//bean[@id='dataSource']//property[@name='password']/value"
- -v 'new_pass' source.xml
- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName">
- <value>com.mysql.jdbc.Driver</value>
- </property>
- <property name="url">
- <value>jdbc:mysql://x.x.x.x:3306/app
- </value>
- </property>
- <property name="username">
- <value>user1</value>
- </property>
- <property name="password">
- <value>pass1</value>
- </property>
- </bean>
- <?xml version="1.0"?>
- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName">
- <value>com.mysql.jdbc.Driver</value>
- </property>
- <property name="url">
- <value>jdbc:mysql://x.x.x.x:3306/app
- </value>
- </property>
- <property name="username">
- <value>user1</value>
- </property>
- <property name="password">
- <value>new_pass</value>
- </property>
- </bean>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement