clean up
This commit is contained in:
parent
1cc236a683
commit
916dca0207
18
pom.xml
18
pom.xml
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
<gson.version>2.8.5</gson.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -30,6 +31,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<!-- Exclude the default Jackson dependency -->
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-json</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -39,6 +47,11 @@
|
||||||
<groupId>org.springframework.kafka</groupId>
|
<groupId>org.springframework.kafka</groupId>
|
||||||
<artifactId>spring-kafka</artifactId>
|
<artifactId>spring-kafka</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>${gson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -46,11 +59,6 @@
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.h2database</groupId>
|
|
||||||
<artifactId>h2</artifactId>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
|
|
15
src/main/java/com/totopia/server/Application.java
Normal file
15
src/main/java/com/totopia/server/Application.java
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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 {
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.totopia.server.commons.base.gson.annotation.Exclude;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
@ -34,7 +34,7 @@ public class User implements Serializable {
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "password", nullable = false, length = 100)
|
@Column(name = "password", nullable = false, length = 100)
|
||||||
@JsonIgnore
|
@Exclude
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.totopia.server.user.model;
|
package com.totopia.server.user.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -18,6 +17,8 @@ import java.util.Date;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class UserGroup implements Serializable {
|
public class UserGroup implements Serializable {
|
||||||
|
private static final long serialVersionUID = 4801565634000630034L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(generator = "user_group_generator")
|
@GeneratedValue(generator = "user_group_generator")
|
||||||
@SequenceGenerator(name = "user_group_generator", sequenceName = "user_group_sequence", initialValue = 1, allocationSize = 1)
|
@SequenceGenerator(name = "user_group_generator", sequenceName = "user_group_sequence", initialValue = 1, allocationSize = 1)
|
||||||
|
@ -25,7 +26,6 @@ public class UserGroup implements Serializable {
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
@Column(name = "title", nullable = false, length = 100)
|
@Column(name = "title", nullable = false, length = 100)
|
||||||
@JsonIgnore
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
|
|
|
@ -1,42 +1,45 @@
|
||||||
# Spring Boot configuration
|
# Spring Boot configuration
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: totopia-server
|
name: totopia-server
|
||||||
h2:
|
http:
|
||||||
console:
|
converters:
|
||||||
enabled: true
|
preferred-json-mapper: gson
|
||||||
path: /h2-console
|
h2:
|
||||||
datasource:
|
console:
|
||||||
driver-class-name: org.postgresql.Driver
|
enabled: true
|
||||||
url: jdbc:postgresql://localhost:15432/postgres
|
path: /h2-console
|
||||||
data-username: postgres
|
datasource:
|
||||||
password: qwer5795
|
driver-class-name: org.postgresql.Driver
|
||||||
username: postgres
|
url: jdbc:postgresql://localhost:15432/postgres
|
||||||
# JPA properties
|
data-username: postgres
|
||||||
initialization-mode: never
|
username: postgres
|
||||||
jpa:
|
password: qwer5795
|
||||||
hibernate:
|
# JPA properties
|
||||||
ddl-auto: update
|
initialization-mode: never
|
||||||
database: postgresql
|
jpa:
|
||||||
show-sql: true
|
|
||||||
database-platform: org.hibernate.dialect.PostgreSQLDialect
|
|
||||||
properties:
|
|
||||||
hibernate:
|
hibernate:
|
||||||
|
ddl-auto: update
|
||||||
|
database: postgresql
|
||||||
|
show-sql: true
|
||||||
|
database-platform: org.hibernate.dialect.PostgreSQLDialect
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
temp:
|
temp:
|
||||||
use_jdbc_metadata_defaults: false
|
use_jdbc_metadata_defaults: false
|
||||||
|
|
||||||
|
|
||||||
# Logger configuration
|
# Logger configuration
|
||||||
logging:
|
logging:
|
||||||
pattern:
|
pattern:
|
||||||
console: "%d %-5level %logger : %msg%n"
|
console: "%d %-5level %logger : %msg%n"
|
||||||
level:
|
level:
|
||||||
org.springframework: INFO
|
root: ERROR
|
||||||
org.hibernate: DEBUG
|
org.springframework: INFO
|
||||||
|
org.hibernate: DEBUG
|
||||||
|
|
||||||
# Server configuration
|
# Server configuration
|
||||||
server:
|
server:
|
||||||
port: 8088
|
port: 8088
|
||||||
servlet:
|
servlet:
|
||||||
context-path: /api
|
context-path: /api
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user