mirror of
https://github.com/moshowgame/SpringBootCodeGenerator.git
synced 2025-12-26 05:48:33 +08:00
| 2024.04.22 | [Java CI with Maven](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml) 更新<br>SpringBoot升级到3.2.5<br>FastJSON升级到FastJSON2.0.49|
| 2024.04.22 | [Java CI with Maven](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml) 更新<br>SpringBoot升级到3.2.5<br>FastJSON升级到FastJSON2.0.49|
This commit is contained in:
parent
303d1eeae7
commit
d04f479b28
17
README.md
17
README.md
@ -4,7 +4,7 @@
|
|||||||

|

|
||||||

|

|
||||||

|

|
||||||
[](https://travis-ci.org/moshowgame/SpringBootCodeGenerator)
|
[](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml)
|
||||||
|
|
||||||
# Author
|
# Author
|
||||||
>powered by `Moshow郑锴(大狼狗)` , [https://zhengkai.blog.csdn.net](https://zhengkai.blog.csdn.net)
|
>powered by `Moshow郑锴(大狼狗)` , [https://zhengkai.blog.csdn.net](https://zhengkai.blog.csdn.net)
|
||||||
@ -73,10 +73,10 @@
|
|||||||
# Update Logs
|
# Update Logs
|
||||||
| 更新日期 | 更新内容 |
|
| 更新日期 | 更新内容 |
|
||||||
|:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|:-----------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| 2024.04.21 | 推出JDK11分支,支持JDK8/JDK11/JDK17等版本,兼容性较好但维护速度较慢,为了更好兼容旧机器和旧环境
|
| 2024.04.22 | [Java CI with Maven](https://github.com/moshowgame/SpringBootCodeGenerator/actions/workflows/maven.yml) 更新<br>SpringBoot升级到3.2.5<br>FastJSON升级到FastJSON2.0.49|
|
||||||
| 2024.04.20 | 修复CDN版本cdn.staticfile.org域名备份失败问题,已同步更新到cdn.staticfile.net(本地版本则不受影响)
|
| 2024.04.21 | 推出JDK11分支,支持JDK8/JDK11/JDK17等版本,兼容性较好但维护速度较慢,为了更好兼容旧机器和旧环境|
|
||||||
| 2024.01.26 | 修复大写下滑线列名转驼峰问题(感谢@Nisus-Liu
|
| 2024.04.20 | 修复CDN版本cdn.staticfile.org域名备份失败问题,已同步更新到cdn.staticfile.net(本地版本则不受影响)|
|
||||||
的PR) |
|
| 2024.01.26 | 修复大写下滑线列名转驼峰问题(感谢@Nisus-Liu的PR)|
|
||||||
| 2023.10.22 | 工具站CDN更新。 |
|
| 2023.10.22 | 工具站CDN更新。 |
|
||||||
| 2023.08.31 | (感谢@Nisus-Liu的PR)<br>fix 驼峰列名转命名风格错误问题<br>增强转下划线命名风格, 对原始风格不敏感. 支持各种命名风格的列名 to 下划线<br>增加 NonCaseString 大小写不敏感字符串包装类, 简化编码<br>几点代码小优化。 |
|
| 2023.08.31 | (感谢@Nisus-Liu的PR)<br>fix 驼峰列名转命名风格错误问题<br>增强转下划线命名风格, 对原始风格不敏感. 支持各种命名风格的列名 to 下划线<br>增加 NonCaseString 大小写不敏感字符串包装类, 简化编码<br>几点代码小优化。 |
|
||||||
| 2023.07.11 | 安全更新,正式支持SpringBoot3,javax升级到jakarta。 |
|
| 2023.07.11 | 安全更新,正式支持SpringBoot3,javax升级到jakarta。 |
|
||||||
@ -174,6 +174,13 @@
|
|||||||
2. COPY并编写freemarker模板文件`.ftl`
|
2. COPY并编写freemarker模板文件`.ftl`
|
||||||
3. 修改`template.json`文件,新增模板信息,页面可动态加载
|
3. 修改`template.json`文件,新增模板信息,页面可动态加载
|
||||||
|
|
||||||
|
# Upgrade Issue Resolution 升级问题解决方案
|
||||||
|
- 如果你最近也在升级FastJson到FastJson2版本,而跟我一样也遇到了FastJsonHttpMessageConverter找不到类问题以及FastJsonConfig找不到问题,那么恭喜你,看完本文,安装完fastjson2、fastjson2-extension、fastjson2-extension-spring6这三个类库,你就可以成功使用新版FastJson2了。
|
||||||
|
[FastJson2中FastJsonHttpMessageConverter找不到类问题](https://blog.csdn.net/moshowgame/article/details/138013669)
|
||||||
|
|
||||||
|
- 当项目从2.7.x的springboot升级到3.0.x的时候,遇到一个问题“java: 程序包javax.servlet.http不存在” 问题:
|
||||||
|
[java: 程序包javax.servlet.http不存在](https://zhengkai.blog.csdn.net/article/details/131362304)
|
||||||
|
|
||||||
<img src="./codegenerator1.png">
|
<img src="./codegenerator1.png">
|
||||||
<img src="./codegenerator2.png">
|
<img src="./codegenerator2.png">
|
||||||
<img src="./site_analysis-2024.png">
|
<img src="./site_analysis-2024.png">
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
package com.softdev.system.generator.config;
|
package com.softdev.system.generator.config;
|
||||||
|
|
||||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
|
||||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
// import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||||
|
// import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||||
import jakarta.servlet.DispatcherType;
|
import jakarta.servlet.DispatcherType;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -12,8 +13,14 @@ import org.springframework.http.converter.StringHttpMessageConverter;
|
|||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONReader;
|
||||||
|
import com.alibaba.fastjson2.JSONWriter;
|
||||||
|
import com.alibaba.fastjson2.support.config.FastJsonConfig;
|
||||||
|
import com.alibaba.fastjson2.support.spring6.http.converter.FastJsonHttpMessageConverter;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 2019-2-11 liutf WebMvcConfig 整合 cors 和 SpringMvc MessageConverter
|
* 2019-2-11 liutf WebMvcConfig 整合 cors 和 SpringMvc MessageConverter
|
||||||
@ -36,25 +43,43 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
|
// converters.clear();
|
||||||
|
// //FastJsonHttpMessageConverter
|
||||||
|
// FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
||||||
|
|
||||||
|
// List<MediaType> fastMediaTypes = new ArrayList<>();
|
||||||
|
// fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
// fastConverter.setSupportedMediaTypes(fastMediaTypes);
|
||||||
|
|
||||||
|
// FastJsonConfig fastJsonConfig = new FastJsonConfig();
|
||||||
|
// fastJsonConfig.setCharset(StandardCharsets.UTF_8);
|
||||||
|
// fastConverter.setFastJsonConfig(fastJsonConfig);
|
||||||
|
|
||||||
|
// //StringHttpMessageConverter
|
||||||
|
// StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
|
||||||
|
// stringConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||||
|
// stringConverter.setSupportedMediaTypes(fastMediaTypes);
|
||||||
|
// converters.add(stringConverter);
|
||||||
|
// converters.add(fastConverter);
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* FASTJSON2升级 by https://zhengkai.blog.csdn.net/
|
||||||
|
* https://blog.csdn.net/moshowgame/article/details/138013669
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
//FastJsonHttpMessageConverter
|
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
|
||||||
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
//自定义配置...
|
||||||
|
FastJsonConfig config = new FastJsonConfig();
|
||||||
List<MediaType> fastMediaTypes = new ArrayList<>();
|
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
|
config.setReaderFeatures(JSONReader.Feature.FieldBased, JSONReader.Feature.SupportArrayToBean);
|
||||||
fastConverter.setSupportedMediaTypes(fastMediaTypes);
|
config.setWriterFeatures(JSONWriter.Feature.WriteMapNullValue, JSONWriter.Feature.PrettyFormat);
|
||||||
|
converter.setFastJsonConfig(config);
|
||||||
FastJsonConfig fastJsonConfig = new FastJsonConfig();
|
converter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||||
fastJsonConfig.setCharset(StandardCharsets.UTF_8);
|
converter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||||
fastConverter.setFastJsonConfig(fastJsonConfig);
|
converters.add(0, converter);
|
||||||
|
|
||||||
//StringHttpMessageConverter
|
|
||||||
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
|
|
||||||
stringConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
|
||||||
stringConverter.setSupportedMediaTypes(fastMediaTypes);
|
|
||||||
converters.add(stringConverter);
|
|
||||||
converters.add(fastConverter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package com.softdev.system.generator.service;
|
package com.softdev.system.generator.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.softdev.system.generator.entity.TemplateConfig;
|
import com.softdev.system.generator.entity.TemplateConfig;
|
||||||
import com.softdev.system.generator.util.FreemarkerUtil;
|
import com.softdev.system.generator.util.FreemarkerUtil;
|
||||||
import com.softdev.system.generator.util.MapUtil;
|
import com.softdev.system.generator.util.MapUtil;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package com.softdev.system.generator.util;
|
package com.softdev.system.generator.util;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.softdev.system.generator.entity.ClassInfo;
|
import com.softdev.system.generator.entity.ClassInfo;
|
||||||
import com.softdev.system.generator.entity.FieldInfo;
|
import com.softdev.system.generator.entity.FieldInfo;
|
||||||
import com.softdev.system.generator.entity.NonCaseString;
|
import com.softdev.system.generator.entity.NonCaseString;
|
||||||
|
|||||||
37
pom.xml
37
pom.xml
@ -11,7 +11,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.0.8</version>
|
<version>3.2.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@ -46,10 +46,28 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
|
||||||
<dependency>
|
<!-- <dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>2.0.34</version>
|
<version>2.0.34</version>
|
||||||
|
</dependency> -->
|
||||||
|
<!-- FastJson2中FastJsonHttpMessageConverter找不到类问题 by https://zhengkai.blog.csdn.net/-->
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
<version>2.0.49</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2-extension</artifactId>
|
||||||
|
<version>2.0.49</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2-extension-spring6 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2-extension-spring6</artifactId>
|
||||||
|
<version>2.0.49</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
|
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
|
||||||
@ -85,7 +103,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.22</version>
|
<version>1.18.32</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- freemarker -->
|
<!-- freemarker -->
|
||||||
@ -95,23 +113,30 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<!--server issue-->
|
<!--server issue-->
|
||||||
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
|
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
|
||||||
<dependency>
|
<!-- <dependency>
|
||||||
<groupId>javax.xml.bind</groupId>
|
<groupId>javax.xml.bind</groupId>
|
||||||
<artifactId>jaxb-api</artifactId>
|
<artifactId>jaxb-api</artifactId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.1</version>
|
||||||
|
</dependency> -->
|
||||||
|
<!-- https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.xml.bind</groupId>
|
||||||
|
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||||
|
<version>4.0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.12.0</version>
|
<version>3.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
|
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.11.0</version>
|
<version>2.16.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user