# shangting-lease
**Repository Path**: javaStudy_2026/shangting-lease
## Basic Information
- **Project Name**: shangting-lease
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MulanPSL-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-06-14
- **Last Updated**: 2026-06-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
```
[remote "origin"]
url = https://gitee.com/vuejs-study/shangting-lease.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "gitee"]
url = git@gitee.com:byd2025/shangting-lease.git
# url = https://gitee.com/byd2025/shangting-lease.git
fetch = +refs/heads/*:refs/remotes/gitee/*
[remote "aliyun"]
url = ssh://git@172.16.10.111:22022/gitdata/atguigu/shangting-lease.git
fetch = +refs/heads/*:refs/remotes/aliyun/*
# [remote "gogs"]
# url = http://192.168.8.17:10080/EBO-ASP/shangting-lease.git
# fetch = +refs/heads/*:refs/remotes/gogs/*
```
```
sudo mkdir -p /gitdata/atguigu/shangting-lease.git
cd /gitdata/atguigu
git init --bare shangting-lease.git/
sudo chown -R git:git shangting-lease.git/
此时的git地址 : ssh://git@172.16.10.111:22022/gitdata/atguigu/shangting-lease.git
git clone ssh://git@172.16.10.111:22022/gitdata/atguigu/shangting-lease.git
git remote add aliyun ssh://git@172.16.10.111:22022/gitdata/atguigu/shangting-lease.git
mkdir shangting-lease
cd shangting-lease
git init
git add .
git commit -m "first commit"
git remote add origin git@gitee.com:javaStudy_2026/shangting-lease.git
git push -u origin "master"
```
静态方法
```java
@Component
public class JsonUtil {
private static ObjectMapper MAPPER;
@Autowired
public void setMapper(ObjectMapper objectMapper) {
MAPPER = objectMapper;
}
}
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
return mapper;
}
```
# maven
## json
```xml
org.springframework.boot
spring-boot-starter-json
com.fasterxml.jackson.core
jackson-databind
compile
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
compile
```
```java
// 方式1:Bean 配置(推荐,统一管理)
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
// 方式2:application.yml(无需改代码)
spring:
jackson:
deserialization:
fail-on-unknown-properties: false
// 方式3:实体类注解(只对该类生效,精细控制)
@JsonIgnoreProperties(ignoreUnknown = true)
public class PaymentType { ... }
@Configuration
public class JacksonConfig {
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
// =========================
// 1. Java 8 时间
// =========================
mapper.registerModule(new JavaTimeModule());
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
// =========================
// 2. 忽略未知字段(兼容前端)
// =========================
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// =========================
// 3. null 不返回(接口更干净)
// =========================
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
// =========================
// 4. 空对象不报错
// =========================
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
// =========================
// 5. Long → String(前端安全)
// =========================
SimpleModule module = new SimpleModule();
module.addSerializer(Long.class, ToStringSerializer.instance);
module.addSerializer(Long.TYPE, ToStringSerializer.instance);
mapper.registerModule(module);
return mapper;
}
}
```