diff --git a/pom.xml b/pom.xml
index 4583e96..10c31c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,6 +9,7 @@
0.0.1-SNAPSHOT
+
org.apache.logging.log4j
log4j-api
@@ -19,6 +20,8 @@
log4j-core
2.23.1
+
+
org.springframework.boot
spring-boot-starter-web
@@ -30,12 +33,12 @@
3.3.2
+
org.hibernate
hibernate-core
6.6.0.CR1
-
org.postgresql
postgresql
diff --git a/src/main/java/wtf/beatrice/releasehive/Main.java b/src/main/java/wtf/beatrice/releasehive/Main.java
index 1d91f90..d75935a 100644
--- a/src/main/java/wtf/beatrice/releasehive/Main.java
+++ b/src/main/java/wtf/beatrice/releasehive/Main.java
@@ -18,22 +18,25 @@ public class Main {
public static void main(String[] args) {
LOGGER.info("Hello world!");
+
+ LOGGER.info("Registering shutdown hooks");
Runtime.getRuntime().addShutdownHook(shutdownHook);
+ LOGGER.info("Initializing database backend");
+ HibernateManager.initialize();
+
LOGGER.info("Initializing Spring Boot");
SpringApplication.run(Main.class, args);
- LOGGER.info("Spring Boot initialized!");
- HibernateManager.initialize();
+ LOGGER.info("Spring Boot & DB initialized!");
Session session = HibernateManager.getSession();
Transaction transaction = session.beginTransaction();
List users = session.createQuery("FROM User", User.class).getResultList();
- for (User user : users) {
- LOGGER.info("ID: {}, Name: {}", user.getUuid(), user.getUsername());
- }
transaction.commit();
+ users.forEach(user -> LOGGER.info("ID: {}, Name: {}", user.getUuid(), user.getUsername()));
+
}
private static final Thread shutdownHook = new Thread(() -> {
diff --git a/src/main/java/wtf/beatrice/releasehive/resource/AccountResource.java b/src/main/java/wtf/beatrice/releasehive/resource/AccountResource.java
index 60de277..68a6841 100644
--- a/src/main/java/wtf/beatrice/releasehive/resource/AccountResource.java
+++ b/src/main/java/wtf/beatrice/releasehive/resource/AccountResource.java
@@ -1,8 +1,10 @@
package wtf.beatrice.releasehive.resource;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import wtf.beatrice.releasehive.util.JsonUtil;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
import wtf.beatrice.releasehive.model.User;
import wtf.beatrice.releasehive.service.AccountService;
diff --git a/src/main/java/wtf/beatrice/releasehive/service/AccountServiceImpl.java b/src/main/java/wtf/beatrice/releasehive/service/AccountServiceImpl.java
index 7762da4..d9b2914 100644
--- a/src/main/java/wtf/beatrice/releasehive/service/AccountServiceImpl.java
+++ b/src/main/java/wtf/beatrice/releasehive/service/AccountServiceImpl.java
@@ -17,7 +17,6 @@ public class AccountServiceImpl implements AccountService {
return JsonUtil.spawnJsonError("Cannot register user without username");
}
-
if(null == user.getPassword() || user.getPassword().isEmpty()) {
return JsonUtil.spawnJsonError("Cannot register user without password");
}