Здравствуйте! При попытке запустить приложение, возникает ошибка, но в консоле ничего нет, что можно сделать?
Application.class
package webApi;
import imsql.SQLConnector;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import webApi.pay.database.Tables;
@EnableAutoConfiguration
@SpringBootApplication
public class Application {
public static void main(String[] args) {
Tables.check();
try {
SpringApplication.run(Application.class, args);
} catch (Throwable e) {
e.printStackTrace();
}
}
private static final SQLConnector pay_database = createConnectToPay();
private static SQLConnector createConnectToPay() {
return new SQLConnector("host", "port", "Pay", "centrum", "pswr");
}
public static SQLConnector getConnectToPay(){
return pay_database;
}
}
Controller Class
package webApi.pay.methods;
import imsql.SQLConnector;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import webApi.Application;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
@RestController
public class GetInfo {
private final SQLConnector database = Application.getConnectToPay();
@RequestMapping(value = "/get-info")
public String getInfo(@RequestParam(name = "uuid") String uuid) {
HashMap<String, Object> response = new HashMap<>();
if (uuid.isEmpty()) {
response.put("message", "The UUID cannot be empty");
return response.toString();
}
if (!database.has("uuid", "Payments", uuid)) {
response.put("message", "The Payments not found");
return response.toString();
}
try {
response.putAll(infoToString(uuid));
} catch (SQLException e) {
response.put("message", "An error occurred while receiving payment information");
return response.toString();
}
return response.toString();
}
private ResultSet get(String value) throws SQLException {
String query = "SELECT * FROM payments WHERE uuid = ?";
PreparedStatement preparedStatement = database.getConnection().prepareStatement(query);
preparedStatement.setString(1, value);
return preparedStatement.executeQuery();
}
private HashMap<String, Object> infoToString(String uuid) throws SQLException {
ResultSet resultSet = get(uuid);
HashMap<String, Object> response = new HashMap<>();
while (resultSet.next()) {
int columnCount = resultSet.getMetaData().getColumnCount();
for (int i = 1; i <= columnCount; i++) {
String columnName = resultSet.getMetaData().getColumnName(i);
Object columnValue = resultSet.getObject(i);
response.put(columnName, columnValue);
}
}
return response;
}
}
Tables Class
package webApi.pay.database;
import imsql.SQLConnector;
import webApi.Application;
public class Tables {
private static final SQLConnector database = Application.getConnectToPay();
public static void check() {
database.get("CREATE TABLE IF NOT EXISTS Payments(uuid TEXT, value FLOAT, about TEXT, status TEXT, isPaid BOOLEAN, project TEXT, createDate DATE, payDate DATE)");
}
}