Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
alibaba avatar

Arthas Springcontext Issues Resolve

  • 2 installs
  • 37.5k repo stars
  • Updated July 24, 2026
  • alibaba/arthas

arthas-springcontext-issues-resolve is a Claude skill that diagnoses Spring ApplicationContext, Bean, and config-injection issues with Arthas vmtool.

About

arthas-springcontext-issues-resolve is a Claude skill for diagnosing Spring ApplicationContext, Bean, and configuration-injection problems with Arthas vmtool. A developer uses it to inspect a running Spring app: reading config values and sources, checking whether a bean exists without triggering initialization, searching beans by keyword or type, and inspecting BeanDefinitions. It favors read-only queries to avoid side effects.

  • Diagnoses Spring ApplicationContext, Bean, and config-injection issues with Arthas vmtool
  • Uses read-only queries (containsBean, getBeanNamesForType) to avoid triggering Bean initialization
  • Resolves NoUniqueBeanDefinition and ClassLoader mismatch problems with OGNL expressions

Arthas Springcontext Issues Resolve by the numbers

  • 2 all-time installs (skills.sh)
  • Ranked #464 of 596 Debugging skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

arthas-springcontext-issues-resolve capabilities & compatibility

Free; open-source Arthas tooling, no API keys.

Capabilities
spring context inspection · bean diagnostics · jvm diagnostics
Use cases
debugging
Pricing
Free
From the docs

What arthas-springcontext-issues-resolve says it does

排查 Spring ApplicationContext / Bean / 配置注入等问题
SKILL.md
**先只读查询**(contains/beanNames/type/environment),避免直接 `getBean()` 触发 Bean 初始化产生副作用。
SKILL.md
npx skills add https://github.com/alibaba/arthas --skill arthas-springcontext-issues-resolve

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2
repo stars37.5k
Last updatedJuly 24, 2026
Repositoryalibaba/arthas

What it does

Diagnose Spring ApplicationContext, Bean, and config-injection problems in a running JVM using Arthas vmtool read-only queries.

Who is it for?

Debugging Spring bean wiring and config injection in a live application

Skip if: Non-Spring apps or offline static analysis

When should I use this skill?

A Spring bean is missing, ambiguous, or a config value is not injected as expected

What you get

The bean or config problem is localized using safe read-only Arthas vmtool queries.

  • A root-cause finding for the bean or config-injection issue

Files

SKILL.mdMarkdownGitHub ↗

Spring Context / Bean 排查指南

原则:

  • 先只读查询(contains/beanNames/type/environment),避免直接 getBean() 触发 Bean 初始化产生副作用。
  • 严格限量vmtool -l 控制实例数量;避免无条件输出完整 getBeanDefinitionNames()

1) 获取并挑选正确的 ApplicationContext

优先尝试获取常见的 Spring Boot Context(通常是 AbstractApplicationContext 子类):

vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 5

如果拿不到结果,可以尝试获取: org.springframework.context.ApplicationContext

如果获取到多个对象,可以从对象的 classloader 的 Class<?> name 来判断。

1. 应用的 ClassLoader 通常是包含 LaunchedURLClassLoader 2. 应用的 ClassLoader 绝不会是 com.taobao.pandora.service.loader.ModuleClassLoader

2) 获取配置项的值与来源

只看值(示例:server.port):

vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express 'instances[0].getEnvironment().getProperty("server.port")'

获取“来源”

vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express '#env=instances[0].getEnvironment(), #ps=#env.getPropertySources().get("configurationProperties"), #ps.findConfigurationProperty("server.port")'

如果应用有集成 spring-boot-starter-actuator ,可以尝试

vmtool --action getInstances \
--className org.springframework.boot.actuate.env.EnvironmentEndpoint \
--express 'instances[0].environmentEntry("server.port")'

3) 按 Bean Name 验证是否存在(不触发初始化)

假设你要查的 beanName 为 fooService

vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express 'instances[0].containsBean("fooService")'
vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express 'instances[0].containsLocalBean("fooService")'
vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express 'instances[0].containsBeanDefinition("fooService")'
vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express 'instances[0].getAliases("fooService")'

判读:

  • containsBean=truecontainsLocalBean=false:Bean 可能来自父 Context
  • containsBean=false 且你确定应该存在:优先检查是否选错 Context@Profile/@Conditional、配置项/环境变量是否生效。

4) 在 Spring Context 里“搜” Bean(按关键词过滤,限制输出)

当你只有一个关键词(比如 order / datasource)而不知道精确 beanName 时:

vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express '#ctx=instances[0], #names=@java.util.Arrays@asList(#ctx.getBeanDefinitionNames()), #m=#names.{? #this.toLowerCase().contains("order")}, #m.subList(0, @java.lang.Math@min(#m.size(), 50))'

说明:

  • 先用关键词把范围收敛,再最多输出 50 个候选;拿到候选 beanName 后回到第 3 步逐个验证。

5) 按类型查找 Bean(最适合定位“注入到了哪个实现”)

当你知道目标类型(接口/父类)全限定名时(示例:com.foo.OrderService):

vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express 'instances[0].getBeanNamesForType(@com.foo.OrderService@class)'

若返回多个候选(NoUniqueBeanDefinitionException 常见根因),只看候选名称即可:

vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express 'instances[0].getBeansOfType(@com.foo.OrderService@class).keySet()'

提示:

  • 若怀疑代理导致类型不匹配(JDK Proxy / CGLIB),应优先按接口类型查询,再决定是否需要获取实例进一步确认。
  • @com.foo.OrderService@classClassNotFound,通常是类加载器不对:先用 classloader(stats/instances/tree)找到应用的 classLoaderHash,再在 vmtool/ognl 上加 --classLoader <hash> 重新执行。也可以找到 classloader的 Class Name,再使用 --classLoaderClass 参数。

6) 查看 BeanDefinition(来源/工厂方法/作用域)

当你需要确认 Bean 是怎么注册进来的(@Bean 工厂方法?XML?自动扫描?)时,可尝试拿 BeanFactoryBeanDefinition(前提:Context 是 AbstractApplicationContext)。

vmtool --action getInstances --className org.springframework.context.support.AbstractApplicationContext -l 1 --express '#ctx=instances[0], #bf=#ctx.getBeanFactory(), #bd=#bf.getBeanDefinition("fooService")'

Related skills

FAQ

How does it avoid side effects?

It uses read-only queries like containsBean and getBeanNamesForType and avoids getBean(), which can trigger bean initialization.

How does it get a config value's source?

It reads getEnvironment().getProperty() for the value and findConfigurationProperty() for the source via vmtool OGNL expressions.

Debugginginframonitoring

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.