diff --git a/pom.xml b/pom.xml
index e9cff5d..d54d008 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,6 +16,7 @@
1.8
+ 2.8.5
@@ -30,6 +31,13 @@
org.springframework.boot
spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-json
+
+
org.springframework.boot
@@ -39,6 +47,11 @@
org.springframework.kafka
spring-kafka
+
+ com.google.code.gson
+ gson
+ ${gson.version}
+
org.springframework.boot
@@ -46,11 +59,6 @@
runtime
true
-
- com.h2database
- h2
- runtime
-
org.postgresql
postgresql
diff --git a/src/main/java/com/totopia/server/Application.java b/src/main/java/com/totopia/server/Application.java
new file mode 100644
index 0000000..4c6dde2
--- /dev/null
+++ b/src/main/java/com/totopia/server/Application.java
@@ -0,0 +1,15 @@
+package com.totopia.server;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
+
+@SpringBootApplication
+@EnableAutoConfiguration(exclude = { JacksonAutoConfiguration.class })
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/src/main/java/com/totopia/server/ApplicationGsonExclusionStrategy.java b/src/main/java/com/totopia/server/ApplicationGsonExclusionStrategy.java
new file mode 100644
index 0000000..3e16a42
--- /dev/null
+++ b/src/main/java/com/totopia/server/ApplicationGsonExclusionStrategy.java
@@ -0,0 +1,30 @@
+package com.totopia.server;
+
+import com.google.gson.ExclusionStrategy;
+import com.google.gson.FieldAttributes;
+import com.totopia.server.commons.base.gson.annotation.Exclude;
+
+import org.springframework.boot.autoconfigure.gson.GsonBuilderCustomizer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ApplicationGsonExclusionStrategy {
+
+ @Bean
+ GsonBuilderCustomizer gsonBuilderCustomizer() {
+ return (gsonBuilder) -> gsonBuilder.addSerializationExclusionStrategy(new ExclusionStrategy() {
+
+ @Override
+ public boolean shouldSkipField(FieldAttributes f) {
+ return f.getAnnotation(Exclude.class) != null;
+ }
+
+ @Override
+ public boolean shouldSkipClass(Class> clazz) {
+ return false;
+ }
+
+ });
+ }
+}
diff --git a/src/main/java/com/totopia/server/ServerApplication.java b/src/main/java/com/totopia/server/ServerApplication.java
deleted file mode 100644
index a86cfa1..0000000
--- a/src/main/java/com/totopia/server/ServerApplication.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.totopia.server;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class ServerApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(ServerApplication.class, args);
- }
-}
diff --git a/src/main/java/com/totopia/server/commons/base/gson/annotation/Exclude.java b/src/main/java/com/totopia/server/commons/base/gson/annotation/Exclude.java
new file mode 100644
index 0000000..daf6dad
--- /dev/null
+++ b/src/main/java/com/totopia/server/commons/base/gson/annotation/Exclude.java
@@ -0,0 +1,11 @@
+package com.totopia.server.commons.base.gson.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface Exclude {
+}
diff --git a/src/main/java/com/totopia/server/user/model/User.java b/src/main/java/com/totopia/server/user/model/User.java
index eccece4..cd806cd 100644
--- a/src/main/java/com/totopia/server/user/model/User.java
+++ b/src/main/java/com/totopia/server/user/model/User.java
@@ -5,7 +5,7 @@ import java.util.Date;
import javax.persistence.*;
-import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.totopia.server.commons.base.gson.annotation.Exclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -34,7 +34,7 @@ public class User implements Serializable {
@Basic
@Column(name = "password", nullable = false, length = 100)
- @JsonIgnore
+ @Exclude
private String password;
@Basic
diff --git a/src/main/java/com/totopia/server/user/model/UserGroup.java b/src/main/java/com/totopia/server/user/model/UserGroup.java
index 6af4b95..fee6a3c 100644
--- a/src/main/java/com/totopia/server/user/model/UserGroup.java
+++ b/src/main/java/com/totopia/server/user/model/UserGroup.java
@@ -1,6 +1,5 @@
package com.totopia.server.user.model;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -18,6 +17,8 @@ import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
public class UserGroup implements Serializable {
+ private static final long serialVersionUID = 4801565634000630034L;
+
@Id
@GeneratedValue(generator = "user_group_generator")
@SequenceGenerator(name = "user_group_generator", sequenceName = "user_group_sequence", initialValue = 1, allocationSize = 1)
@@ -25,7 +26,6 @@ public class UserGroup implements Serializable {
@Basic
@Column(name = "title", nullable = false, length = 100)
- @JsonIgnore
private String title;
@Basic
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 0e68dda..2d2fa8a 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,42 +1,45 @@
# Spring Boot configuration
spring:
- application:
- name: totopia-server
- h2:
- console:
- enabled: true
- path: /h2-console
- datasource:
- driver-class-name: org.postgresql.Driver
- url: jdbc:postgresql://localhost:15432/postgres
- data-username: postgres
- password: qwer5795
- username: postgres
- # JPA properties
- initialization-mode: never
- jpa:
- hibernate:
- ddl-auto: update
- database: postgresql
- show-sql: true
- database-platform: org.hibernate.dialect.PostgreSQLDialect
- properties:
+ application:
+ name: totopia-server
+ http:
+ converters:
+ preferred-json-mapper: gson
+ h2:
+ console:
+ enabled: true
+ path: /h2-console
+ datasource:
+ driver-class-name: org.postgresql.Driver
+ url: jdbc:postgresql://localhost:15432/postgres
+ data-username: postgres
+ username: postgres
+ password: qwer5795
+ # JPA properties
+ initialization-mode: never
+ jpa:
hibernate:
+ ddl-auto: update
+ database: postgresql
+ show-sql: true
+ database-platform: org.hibernate.dialect.PostgreSQLDialect
+ properties:
+ hibernate:
temp:
use_jdbc_metadata_defaults: false
# Logger configuration
logging:
- pattern:
- console: "%d %-5level %logger : %msg%n"
- level:
- org.springframework: INFO
- org.hibernate: DEBUG
+ pattern:
+ console: "%d %-5level %logger : %msg%n"
+ level:
+ root: ERROR
+ org.springframework: INFO
+ org.hibernate: DEBUG
# Server configuration
server:
- port: 8088
- servlet:
- context-path: /api
-
+ port: 8088
+ servlet:
+ context-path: /api