Good day. There is an application on Spring boot and in it a .properties file:

# Database spring.datasource.driverClassName= com.mysql.jdbc.Driver spring.datasource.url= jdbc:mysql://localhost:3306/dbname spring.datasource.username: root spring.datasource.password: root # Hibernate spring.jpa.show-sql= true spring.jpa.hibernate.ddl-auto = create 

In the application you need to use data storage either in the database or in a .CSV file. Changes to .properties take effect only after restarting the JVM.

Question: how to specify in. Properties that the data should be stored either in the database or in a file?

Thank.

  • The question is not clear! Well, "so" you can always make my.superpuper.attribute = value and in the code process as you like! - JVic
  • You need to build on the condition that determines where you save to the database or CSV. If there is any logic in the code, then write down all the settings in the properties file, and create a facade and its two implementations to write in the code, and use one or the other depending on the condition. - Maksim

0