У меня есть приложение весенней загрузки. И есть драйвер postgres. Но я не хочу устанавливать
spring.datasource.url=jdbc:postgresql://localhost:5432/app
spring.datasource.username=postgres
spring.datasource.password=qwerty
в application.properties, потому что я сделал это позже в коде.
Если я удалю эту часть, у меня возникнет проблема:
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine suitable jdbc url
Как это исправить?
UPD:
@RequestMapping(value = "setdb/{url}/{db}/{schema}/{login}/{password}")
public String setDB(@PathVariable(name = "url") String url,
@PathVariable(name = "db") String db,
@PathVariable(name = "schema") String schema,
@PathVariable(name = "login") String login,
@PathVariable(name = "password") String password) throws SQLException, ClassNotFoundException {
this.url = url;
this.db = db;
this.schema = schema;
this.login = login;
this.password = password;
Class.forName("org.postgresql.Driver");
url = "jdbc:postgresql://" + url + "/" + db + "?currentSchema=" + schema + "/";
connection = DriverManager.getConnection(url, login, password);
//anothercode
}