Yaml file using # sign as comment
################
# SCALAR TYPES #
###############
Now inside properties file i have following value
root#
as password but yaml file using as comment , how can i skip it.
spring:
#data source connection
datasource:
url: jdbc:mysql://localhost:3306/vaquarkhan
username: rootadmin
password: root#
YAML doesn't require quoting most strings but you'll want to quote special characters if they fall within a certain list of characters. Use quotes if your value includes any of the following special characters: { , } , [ , ] , & , * , # , ? , | , - , < , > , = , ! , % , @ , : also ` and , YAML Spec.
When double quotes, "...." , go around a scalar string you use backslash ( \ ) for escaping, and you have to escape at least the backslash and the double quotes. In addition you can escape other special characters like linefeed ( \n ) and escape an end-of-line by preceding it by a backslash.
The list of special characters in YAML must be escaped.
:, {, }, [, ], ,, &, *, #, ?, |, -, <, >, =, !, %, @, `
You may either quote the string
"root#"
or use back slash.
root\#
I think you can use quotation marks:
spring:
#data source connection
datasource:
url: jdbc:mysql://localhost:3306/vaquarkhan
username: rootadmin
password: 'root#'
This could be best way to do it.
spring:
#data source connection
datasource:
url: jdbc:mysql://localhost:3306/vaquarkhan
username: rootadmin
password: 'root#'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With