alibaba / alibaba/jetcache

DefaultSpringEncoderParser自定义valueEncoder、valueDecoder时,报空指针异常

Open
#461 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

在查看了DefaultSpringEncoderParser类中的parseDecoder方法,发现可以通过在配置中以"bean:"为前缀来指定自定义的ValueEncoder和ValueDecoder,但发现该类运行到Object bean = applicationContext.getBean(beanName);这一行代码时,由于applicationContext未完成初始化,会报空指针异常,完法实现自定义valueEncoder、valueDecoder。原因是parseDecoder方法会早于该类的setApplicationContext方法之前运行。

Contributor guide

No contributing guide indexed for this repository

Research direction

Read DefaultSpringEncoderParser.parseDecoder and setApplicationContext first, focusing on their execution order and the applicationContext access in parseDecoder. Reproduce the configuration using a "bean:"-prefixed custom ValueEncoder or ValueDecoder, then verify that both can be resolved without a null-pointer exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.