Solon v3.x 更新与兼容说明(预告)
1、纪年
- v0: 2018 ~ 2019 (2y)
- v1: 2020 ~ 2022 (3y)
- v2: 2023 ~ 2024 (2y)
- v3: 2025 ~
2、v2.x 升到 v3.x 提醒
v3.0.0 版本,主要是内核删除了 20Kb 的代码量(代码上,算是 v2.9 的一个子集)。
- 移除的配置,要认真检查;
- 移除的事件,要认真检查;
- 弃用接口移除等编译时会出错提醒,问题不大。
其中,移除的 Before、After 体系影响会比较大:
影响 | 替代方案 |
---|---|
全局方面 | 由 RouterInterceptor 替代 |
本地网关方面 | 由 Filter 替代 |
注解方面(控制器相关) | 由 @Addition(Filter) 替代 |
3、弃用配置移除对应表(要认真检查)
- 移除
类型 | 移除配置名 | 替代配置名 | |
---|---|---|---|
启动参数 | solon:: | ||
- config | config.add | ||
应用属性 | solon:: | ||
- solon.config | solon.config.add |
- 弃用
类型 | 弃用配置名 | 替代配置名 | |
---|---|---|---|
应用属性 | solon-boot:: | ||
- server.session.state.domain | server.session.cookieDomain | ||
- server.session.state.domain.auto | server.session.cookieDomainAuto | ||
solon-web-staticfiles:: | |||
- solon.staticfiles.maxAge | solon.staticfiles.cacheMaxAge |
4、弃用事件移除对应表(要认真检查)
插件 | 移除事件 | 替代方案 | |
---|---|---|---|
solon | @Bean bean? | getBeanAsync(..class, ..) / @Inject .. | |
@Component bean? | getBeanAsync(..class, ..) / @Inject .. | ||
solon-serialization-fastjson | FastjsonActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
FastjsonRenderFactory | getBeanAsync(..class, ..) / @Inject .. | ||
solon-serialization-fastjson2 | Fastjson2ActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
Fastjson2RenderFactory | getBeanAsync(..class, ..) / @Inject .. | ||
solon-serialization-fury | FuryActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
solon-serialization-gson | GsonActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
GsonRenderFactory | getBeanAsync(..class, ..) / @Inject .. | ||
solon-serialization-hessian | HessianActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
solon-serialization-jackson | JacksonActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
JacksonRenderFactory | getBeanAsync(..class, ..) / @Inject .. | ||
solon-serialization-jackson-xml | JacksonXmlActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
JacksonXmlRenderFactory | getBeanAsync(..class, ..) / @Inject .. | ||
solon-serialization-properties | PropertiesActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
PropertiesRenderFactory | getBeanAsync(..class, ..) / @Inject .. | ||
solon-serialization-protostuff | ProtostuffActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
solon-serialization-snack3 | SnackActionExecutor | getBeanAsync(..class, ..) / @Inject .. | |
SnackRenderFactory | getBeanAsync(..class, ..) / @Inject .. | ||
solon-view-beetl | GroupTemplate | getBeanAsync(BeetlRender.class, ..) / @Inject .. | |
solon-view-enjoy | Engine | getBeanAsync(EnjoyRender.class, ..) / @Inject .. | |
solon-view-freemarker | Configuration | getBeanAsync(FreemarkerRender.class, ..) / @Inject .. | |
solon-view-thymeleaf | TemplateEngine | getBeanAsync(ThymeleafRender.class, ..) / @Inject .. | |
solon-view-velocity | RuntimeInstance | getBeanAsync(VelocityRender.class, ..) / @Inject .. |
以上事件替代的扩展方案(示例):
@Configuration
public class App {
public static void main(String[] args) {
Solon.start(App.class, args, app -> {
//1.第一时间手动获取(在其它注入前执行)
app.context().getBeanAsync(Xxx.class, e -> {
});
});
}
//2.由扫描时自动注入
@Bean
public void cfg(Xxx xxx) {
}
}
什么时候用事件扩展好(尽量不用)?
- 需要及时扩展,但又不方便进入容器的对象。
5、弃用类型移除对应表(编译会有提醒)
插件 | 移除类型 | 替代类型 | |
---|---|---|---|
nami | |||
@Body | @NamiBody | ||
NamiBodyAnno | |||
@Mapping | @NamiMapping | ||
NamiMappingAnno | |||
solon | |||
@PathVar | @Path | ||
@PropertySource | @Import | ||
@ProxyComponent | @Component | ||
@Before(Handler) | @Addition(Filter) | ||
@After(Handler) | @Addition(Filter) | ||
Endpoint | / | ||
SolonBuilder | / | ||
ValHolder | / | ||
InitializingBean | @Init | ||
NdMap | IgnoreCaseMap<Object> | ||
solon-data | |||
Serializer | core::Serializer | ||
solon-data-dynamicds | |||
DynamicDsHolder | DynamicDsKey | ||
solon-logging | |||
LogUtilToSlf4j | / | ||
solon-logging-log4j | |||
SolonCloudAppender | / | ||
solon-logging-logback | |||
SolonCloudAppender | / | ||
solon-serialization | |||
JsonConverter | core::Converter | ||
StringSerializer | core::Serializer<String> | ||
solon-test | |||
@TestPropertySource | @Import | ||
@TestRollback | @Rollback | ||
AbstractHttpTester | HttpTester | ||
HttpTestBase | HttpTester |
6、弃用接口方法移除对应表(编译会有提醒)
调整类 | 移除方法(或字段) | 替代方法 | |
---|---|---|---|
nami:: | |||
- Constants | CONTENT_TYPE_* | ||
solon:: | |||
- ActionParamResolver | resolvePathVar() | ||
- ActionDefault | before(.) | / 只留 filter 体系 | |
after(.) | / | ||
- AppContext | beanOnloaded(.) | lifecycle(.) | |
- Bean | registered() | delivered() | |
- BeanContainer | getAttrs() | attachment*(.) | |
beanAround*(.) | beanInterceptor*(.) | ||
- ClassUtil | newInstance(.) | tryInstance(.) | |
- ClassWrap | getFieldAllWraps() | getFieldWraps() | |
- Component | registered() | delivered() | |
- ConditionUtil | ifMissing(.) | ifMissingBean(.) | |
- Context | ip() | remoteIp() | |
param(key,def) | paramOrDefault(key,def) | ||
paramSet(.) | paramMap().add(.) | ||
paramsMap() | paramMap().toValuesMap() | ||
paramsAdd(.) | paramMap().add(.) | ||
files(.) | fileValues(.) | ||
filesMap() | fileMap().toValuesMap() | ||
cookie(key,def) | cookieOrDefault(key,def) | ||
header(key,def) | headerOrDefault(key,def) | ||
headersMap() | headerMap().toValuesMap() | ||
session(key,def) | sessionOrDefault(key,def) | ||
statusSet(.) | status(.) | ||
attr(key,def) | attrOrDefault(key,def) | ||
attrClear() | attrsClear() | ||
- DateAnalyzer | getGlobal() | global() | |
- EventBus | pushAsync() | publishAsync() | |
pushTry() | publishTry() | ||
push() | publish() | ||
- Gateway | before(.) | / 只留 filter 体系 | |
after(.) | / | ||
- LifecycleBean | prestop() | preStop() | |
- LogUtil | debugAsync() | / | |
infoAsync() | / | ||
- MethodHolder | getArounds() | getInterceptors() | |
- MethodWrap | getArounds() | getInterceptors() | |
- MvcFactory | resolveParam(.) | resolveActionParam(.) | |
- NvMap | (map) | from(map) | |
getBean(.) | toBean(.) | ||
- Props | getByParse(.) | getByTmpl(.) | |
getXmap(.) | getMap(.) | ||
getBean(.) | toBean(.) | ||
- RenderManager | mapping(.) | Solon.app().render(key, ) | |
register(.) | Solon.app().render(null, .) | ||
- ResourceUtil | remClasspath(.) | remSchema(.) | |
- Router | matchOne(.) | matchMain(.) | |
- RunUtil | setExecutor(.) | setParallelExecutor(.) | |
- SolonApp | before(.) | / 只留 filter 体系 | |
after(.) | / | ||
- SolonProps | source() | app.source() | |
sourceLocation() | app.sourceLocation() | ||
- Utils | TAG_classpath | / | |
resolvePaths(.) | / | ||
hasClass(.) | ClassUtil.hasClass(.) | ||
loadClass(.) | ClassUtil.loadClass(.) | ||
newInstance(.) | ClassUtil.tryInstance(.) | ||
getResource*(.) | ResourceUtil.getResource*(.) | ||
transferTo*(.) | IoUtil.transferTo*(.) | ||
buildExt(.) | getFolderAndMake(.) | ||
solon-boot:: | |||
- HttpServerConfigure | allowSsl(.) | enableSsl(.) | |
solon-data:: | |||
- CacheService | get(key) | get(key, type) | |
solon-scheduling:: | |||
- IJobManager | setJobInterceptor(.) | addJobInterceptor(.) | |
solon-serialization-properties:: | |||
- PropertiesActionExecutor | includeFormUrlencoded(.) | allowPostForm(.) |
7、弃用插件移除对应表
其中简化了快捷组合包(发现太多,容易混乱),只留两个基础的:
移除插件 | 替代插件 | 备注 |
---|---|---|
:: cloud | ||
solon.cloud.httputils | solon-net-httputils | |
:: detector | ||
detector-solon-plugin | solon-health-detector | |
:: logging | ||
log4j2-solon-plugin | solon-logging-log4j2 | |
logback-solon-plugin | solon-logging-logback | |
:: scheduling | ||
solon.extend.schedule | / | |
:: testing | ||
solon.test | solon-test | |
:: web | ||
solon.web.flux | solon-web-rx | |
:: shortcuts | ||
solon-api | solon-web | |
solon-job | / | 改用 solon-lib + |
solon-rpc | / | 改用 solon-web + |
solon-beetl-web | / | 改用 solon-web + |
solon-enjob-web | / | 改用 solon-web + |
solon-web-beetl | / | 改用 solon-web + |
solon-web-enjoy | / | 改用 solon-web + |
solon-cloud-alibaba | / | 改用 solon-web + solon-cloud + |
solon-cloud-water | / | 改用 solon-web + solon-cloud + |
移除的快捷组合包,可通过以下方式组合:
- solon-job=
- solon-lib + solon-scheduling-simple
- solon-rpc=
- solon-web + nami-coder-snack3 + nami-channl-http-okhttp
- solon-beetl-web(或 solon-web-beetl)=
- solon-web + solon-view-beetl + beetlsql-solon-plugin
- solon-enjoy-web(或 solon-web-enjoy)=
- solon-web + solon-view-enjoy + activerecord-solon-plugin
- solon-cloud-alibaba=
- solon-web + solon-cloud + nacos-solon-cloud-plugin + rocketmq-solon-cloud-plugin + sentinel-solon-cloud-plugin
- solon-cloud-water=
- solon-web + solon-cloud + water-solon-cloud-plugin
8、部分插件名字调整对应表(旧名标为弃用,仍可用)
新的调整按以下插件命名规则执行:
插件命名规则 | 说明 |
---|---|
solon-*(由 solon.* 调整而来) | 表示内部架构插件 |
*-solon-plugin(保持不变) | 表示外部适配插件 |
*-solon-cloud-plugin(保持不变) | 表过云接口外部适配插件 |
对应的“旧名”,仍可使用。预计会保留一年左右。具体调整如下:
新名 | 旧名 | 备注 |
---|---|---|
:: nami | ||
nami-channel-http-hutool | nami.channel.http.hutool | |
nami-channel-http-okhttp | nami.channel.http.okhttp | |
nami-channel-socketd | nami.channel.socketd | |
nami-coder-fastjson | nami.coder.fastjson | |
nami-coder-fastjson2 | nami.coder.fastjson2 | |
nami-coder-fury | nami.coder.fury | |
nami-coder-hessian | nami.coder.hessian | |
nami-coder-jackson | nami.coder.jackson | |
nami-coder-protostuff | nami.coder.protostuff | |
nami-coder-snack3 | nami.coder.snack3 | |
:: base | ||
solon-config-banner | solon.banner | |
solon-config-yaml | solon.config.yaml | |
solon-config-plus | 从原 solon.config.yaml 里拆出来 | |
solon-hotplug | solon.hotplug | |
solon-i18n | solon.i18n | |
solon-mvc | solon.mvc | |
solon-proxy | solon.proxy | |
solon-rx | 新增 | |
:: boot | ||
solon-boot-jdkhttp | solon.boot.jdkhttp | |
solon-boot-jetty-add-jsp | solon.boot.jetty.add.jsp | |
solon-boot-jetty-add-websocket | solon.boot.jetty.add.websocket | |
solon-boot-jetty | solon.boot.jetty | |
solon-boot-jlhttp | solon.boot.jlhttp | |
solon-boot-smarthttp | solon.boot.smarthttp | |
solon-boot-socketd | solon.boot.socketd | |
solon-boot-undertow-add-jsp | solon.boot.undertow.add.jsp | |
solon-boot-undertow | solon.boot.undertow | |
solon-boot-vertx | solon.boot.vertx | |
solon-boot-websocket-netty | solon.boot.websocket.netty | |
solon-boot-websocket | solon.boot.websocket | |
solon-boot | solon.boot | |
:: cloud | ||
solon-cloud-eventplus | solon.cloud.eventplus | |
solon-cloud-gateway | solon.cloud.gateway | |
solon-cloud-metrics | solon.cloud.metrics | |
solon-cloud-tracing | solon.cloud.tracing | |
solon-cloud | solon.cloud | |
:: data | ||
solon-cache-caffeine | solon.cache.caffeine | |
solon-cache-jedis | solon.cache.jedis | |
solon-cache-redisson | solon.cache.redisson | |
solon-cache-spymemcached | solon.cache.spymemcached | |
solon-data-dynamicds | solon.data.dynamicds | |
solon-data-shardingds | solon.data.shardingds | |
solon-data | solon.data | |
:: detector | ||
solon-health-detector | solon.health.detector | |
solon-health | solon.health | |
:: docs | ||
solon-docs-openapi2 | solon.docs.openapi2 | |
solon-docs-openapi3 | ||
solon-docs | solon.docs | |
:: faas | ||
solon-faas-luffy | solon.luffy | |
:: logging | ||
solon-logging-log4j2 | solon.logging.log4j2 | |
solon-logging-logback | solon.logging.logback | |
solon-logging-simple | solon.logging.simple | |
solon-logging | solon.logging | |
:: native | ||
solon-aot | solon.aot | |
::net | ||
solon-net-httputils | solon.net.httputils | |
solon-net-stomp | ||
solon-net | solon.net | |
:: scheduling | ||
solon-scheduling-quartz | solon.scheduling.quartz | |
solon-scheduling-simple | solon.scheduling.simple | |
solon-scheduling | solon.scheduling | |
:: security | ||
solon.auth | 弃用 | |
solon.validation | 弃用 | |
solon.vault | 弃用 | |
solon-security-auth | solon.security.auth | |
solon-security-validation | solon.security.validation | |
solon-security-vault | solon.security.vault | |
:: serialization | ||
solon-serialization | solon.serialization | |
solon-serialization-fastjson | solon.serialization.fastjson | |
solon-serialization-fastjson2 | solon.serialization.fastjson2 | |
solon-serialization-fury | solon.serialization.fury | |
solon-serialization-gson | solon.serialization.gson | |
solon-serialization-hessian | solon.serialization.hessian | |
solon-serialization-jackson | solon.serialization.jackson | |
solon-serialization-jackson-xml | solon.serialization.jackson.xml | |
solon-serialization-kryo | 略过(未发布) | |
solon-serialization-properties | solon.serialization.properties | |
solon-serialization-protostuff | solon.serialization.protostuff | |
solon-serialization-snack3 | solon.serialization.snack3 | |
:: view | ||
solon-view | solon.view | |
solon-view-beetl | solon.view.beetl | |
solon-view-enjoy | solon.view.enjoy | |
solon-view-freemarker | solon.view.freemarker | |
solon-view-jsp | solon.view.jsp | |
solon-view-jsp-jakarta | 略过(未发布) | |
solon-view-thymeleaf | solon.view.thymeleaf | |
solon-view-velocity | solon.view.velocity | |
:: web | ||
solon-sessionstate-jedis | solon.sessionstate.jedis | |
solon-sessionstate-jwt | solon.sessionstate.jwt | |
solon-sessionstate-local | solon.sessionstate.local | |
solon-sessionstate-redisson | solon.sessionstate.redisson | |
solon-web-cors | solon.web.cors | |
solon-web-rx | solon.web.rx | |
solon-web-sdl | solon.web.sdl | |
solon-web-servlet | solon.web.servlet | |
solon-web-servlet-jakarta | solon.web.servlet.jakarta | |
solon-web-sse | solon.web.sse | |
solon-web-staticfiles | solon.web.staticfiles | |
solon-web-stop | solon.web.stop | |
solon-web-webdav | 略过(未发布) |