Solon v3.0.0

Solon v3.x 更新与兼容说明(预告)

</> markdown

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-fastjsonFastjsonActionExecutor getBeanAsync(..class, ..) / @Inject ..
FastjsonRenderFactory getBeanAsync(..class, ..) / @Inject ..
solon-serialization-fastjson2Fastjson2ActionExecutor getBeanAsync(..class, ..) / @Inject ..
Fastjson2RenderFactory getBeanAsync(..class, ..) / @Inject ..
solon-serialization-furyFuryActionExecutor getBeanAsync(..class, ..) / @Inject ..
solon-serialization-gsonGsonActionExecutor getBeanAsync(..class, ..) / @Inject ..
GsonRenderFactory getBeanAsync(..class, ..) / @Inject ..
solon-serialization-hessianHessianActionExecutor getBeanAsync(..class, ..) / @Inject ..
solon-serialization-jacksonJacksonActionExecutor getBeanAsync(..class, ..) / @Inject ..
JacksonRenderFactory getBeanAsync(..class, ..) / @Inject ..
solon-serialization-jackson-xmlJacksonXmlActionExecutor getBeanAsync(..class, ..) / @Inject ..
JacksonXmlRenderFactory getBeanAsync(..class, ..) / @Inject ..
solon-serialization-propertiesPropertiesActionExecutor getBeanAsync(..class, ..) / @Inject ..
PropertiesRenderFactory getBeanAsync(..class, ..) / @Inject ..
solon-serialization-protostuffProtostuffActionExecutor getBeanAsync(..class, ..) / @Inject ..
solon-serialization-snack3SnackActionExecutor getBeanAsync(..class, ..) / @Inject ..
SnackRenderFactory getBeanAsync(..class, ..) / @Inject ..
solon-view-beetlGroupTemplate getBeanAsync(BeetlRender.class, ..) / @Inject ..
solon-view-enjoyEngine getBeanAsync(EnjoyRender.class, ..) / @Inject ..
solon-view-freemarkerConfiguration getBeanAsync(FreemarkerRender.class, ..) / @Inject ..
solon-view-thymeleafTemplateEngine getBeanAsync(ThymeleafRender.class, ..) / @Inject ..
solon-view-velocityRuntimeInstance 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::
- ConstantsCONTENT_TYPE_*
solon::
- ActionParamResolverresolvePathVar()
- ActionDefaultbefore(.) / 只留 filter 体系
after(.) /
- AppContextbeanOnloaded(.) lifecycle(.)
- Beanregistered() delivered()
- BeanContainergetAttrs() attachment*(.)
beanAround*(.) beanInterceptor*(.)
- ClassUtilnewInstance(.) tryInstance(.)
- ClassWrapgetFieldAllWraps() getFieldWraps()
- Componentregistered() delivered()
- ConditionUtilifMissing(.) ifMissingBean(.)
- Contextip() 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()
- DateAnalyzergetGlobal() global()
- EventBuspushAsync() publishAsync()
pushTry() publishTry()
push() publish()
- Gatewaybefore(.) / 只留 filter 体系
after(.) /
- LifecycleBeanprestop() preStop()
- LogUtildebugAsync() /
infoAsync() /
- MethodHoldergetArounds() getInterceptors()
- MethodWrapgetArounds() getInterceptors()
- MvcFactoryresolveParam(.) resolveActionParam(.)
- NvMap(map) from(map)
getBean(.) toBean(.)
- PropsgetByParse(.) getByTmpl(.)
getXmap(.) getMap(.)
getBean(.) toBean(.)
- RenderManagermapping(.) Solon.app().render(key, )
register(.) Solon.app().render(null, .)
- ResourceUtilremClasspath(.) remSchema(.)
- RoutermatchOne(.) matchMain(.)
- RunUtilsetExecutor(.) setParallelExecutor(.)
- SolonAppbefore(.) / 只留 filter 体系
after(.) /
- SolonPropssource() app.source()
sourceLocation() app.sourceLocation()
- UtilsTAG_classpath /
resolvePaths(.) /
hasClass(.) ClassUtil.hasClass(.)
loadClass(.) ClassUtil.loadClass(.)
newInstance(.) ClassUtil.tryInstance(.)
getResource*(.) ResourceUtil.getResource*(.)
transferTo*(.) IoUtil.transferTo*(.)
buildExt(.) getFolderAndMake(.)
solon-boot::
- HttpServerConfigureallowSsl(.) enableSsl(.)
solon-data::
- CacheServiceget(key) get(key, type)
solon-scheduling::
- IJobManagersetJobInterceptor(.) addJobInterceptor(.)
solon-serialization-properties::
- PropertiesActionExecutorincludeFormUrlencoded(.) allowPostForm(.)

7、弃用插件移除对应表

其中简化了快捷组合包(发现太多,容易混乱),只留两个基础的:

移除插件替代插件备注
:: cloud
solon.cloud.httputilssolon-net-httputils
:: detector
detector-solon-pluginsolon-health-detector
:: logging
log4j2-solon-pluginsolon-logging-log4j2
logback-solon-pluginsolon-logging-logback
:: scheduling
solon.extend.schedule/
:: testing
solon.testsolon-test
:: web
solon.web.fluxsolon-web-rx
:: shortcuts
solon-apisolon-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-hutoolnami.channel.http.hutool
nami-channel-http-okhttpnami.channel.http.okhttp
nami-channel-socketdnami.channel.socketd
nami-coder-fastjsonnami.coder.fastjson
nami-coder-fastjson2nami.coder.fastjson2
nami-coder-furynami.coder.fury
nami-coder-hessiannami.coder.hessian
nami-coder-jacksonnami.coder.jackson
nami-coder-protostuffnami.coder.protostuff
nami-coder-snack3nami.coder.snack3
:: base
solon-config-bannersolon.banner
solon-config-yamlsolon.config.yaml
solon-config-plus 从原 solon.config.yaml 里拆出来
solon-hotplugsolon.hotplug
solon-i18nsolon.i18n
solon-mvcsolon.mvc
solon-proxysolon.proxy
solon-rx 新增
:: boot
solon-boot-jdkhttpsolon.boot.jdkhttp
solon-boot-jetty-add-jspsolon.boot.jetty.add.jsp
solon-boot-jetty-add-websocketsolon.boot.jetty.add.websocket
solon-boot-jettysolon.boot.jetty
solon-boot-jlhttpsolon.boot.jlhttp
solon-boot-smarthttpsolon.boot.smarthttp
solon-boot-socketdsolon.boot.socketd
solon-boot-undertow-add-jspsolon.boot.undertow.add.jsp
solon-boot-undertowsolon.boot.undertow
solon-boot-vertxsolon.boot.vertx
solon-boot-websocket-nettysolon.boot.websocket.netty
solon-boot-websocketsolon.boot.websocket
solon-bootsolon.boot
:: cloud
solon-cloud-eventplussolon.cloud.eventplus
solon-cloud-gatewaysolon.cloud.gateway
solon-cloud-metricssolon.cloud.metrics
solon-cloud-tracingsolon.cloud.tracing
solon-cloudsolon.cloud
:: data
solon-cache-caffeinesolon.cache.caffeine
solon-cache-jedissolon.cache.jedis
solon-cache-redissonsolon.cache.redisson
solon-cache-spymemcachedsolon.cache.spymemcached
solon-data-dynamicdssolon.data.dynamicds
solon-data-shardingdssolon.data.shardingds
solon-datasolon.data
:: detector
solon-health-detectorsolon.health.detector
solon-healthsolon.health
:: docs
solon-docs-openapi2solon.docs.openapi2
solon-docs-openapi3
solon-docssolon.docs
:: faas
solon-faas-luffysolon.luffy
:: logging
solon-logging-log4j2solon.logging.log4j2
solon-logging-logbacksolon.logging.logback
solon-logging-simplesolon.logging.simple
solon-loggingsolon.logging
:: native
solon-aotsolon.aot
::net
solon-net-httputilssolon.net.httputils
solon-net-stomp
solon-netsolon.net
:: scheduling
solon-scheduling-quartzsolon.scheduling.quartz
solon-scheduling-simplesolon.scheduling.simple
solon-schedulingsolon.scheduling
:: security
solon.auth弃用
solon.validation弃用
solon.vault弃用
solon-security-authsolon.security.auth
solon-security-validationsolon.security.validation
solon-security-vaultsolon.security.vault
:: serialization
solon-serializationsolon.serialization
solon-serialization-fastjsonsolon.serialization.fastjson
solon-serialization-fastjson2solon.serialization.fastjson2
solon-serialization-furysolon.serialization.fury
solon-serialization-gsonsolon.serialization.gson
solon-serialization-hessiansolon.serialization.hessian
solon-serialization-jacksonsolon.serialization.jackson
solon-serialization-jackson-xmlsolon.serialization.jackson.xml
solon-serialization-kryo 略过(未发布)
solon-serialization-propertiessolon.serialization.properties
solon-serialization-protostuffsolon.serialization.protostuff
solon-serialization-snack3solon.serialization.snack3
:: view
solon-viewsolon.view
solon-view-beetlsolon.view.beetl
solon-view-enjoysolon.view.enjoy
solon-view-freemarkersolon.view.freemarker
solon-view-jspsolon.view.jsp
solon-view-jsp-jakarta 略过(未发布)
solon-view-thymeleafsolon.view.thymeleaf
solon-view-velocitysolon.view.velocity
:: web
solon-sessionstate-jedissolon.sessionstate.jedis
solon-sessionstate-jwtsolon.sessionstate.jwt
solon-sessionstate-localsolon.sessionstate.local
solon-sessionstate-redissonsolon.sessionstate.redisson
solon-web-corssolon.web.cors
solon-web-rxsolon.web.rx
solon-web-sdlsolon.web.sdl
solon-web-servletsolon.web.servlet
solon-web-servlet-jakartasolon.web.servlet.jakarta
solon-web-ssesolon.web.sse
solon-web-staticfilessolon.web.staticfiles
solon-web-stopsolon.web.stop
solon-web-webdav 略过(未发布)