application.properties to set the server port to 8080?In application.properties, properties are defined as key-value pairs separated by an equals sign. The key uses dot notation for hierarchy. So server.port=8080 is correct.
application.properties contains these two lines:spring.datasource.url=jdbc:mysql://localhost:3306/db1spring.datasource.url=jdbc:mysql://localhost:3306/db2What will be the effective value of
spring.datasource.url when the application runs?When duplicate keys exist, the last occurrence overrides previous ones. So the effective value is the second line's URL.
application.properties?To represent new lines inside a property value, use the escape sequence \n. So option C is correct. Actual new lines in the file break the syntax.
server.port=8080
spring.datasource.username=root
spring.datasource.passwordWhat error will Spring Boot raise when loading this configuration?
No error occurs; the property spring.datasource.password is loaded with an empty string value since no separator is found.
application.properties content:app.name=TestApp app.version=1.0 app.description=Sample app app.name=ProdApp app.debug=true
How many unique properties will Spring Boot load?
There are 5 lines but app.name appears twice. The last value overwrites the first, so 4 unique properties are loaded.
