apache/shenyu · error · IllegalArgumentException
spring.application.name or shenyu.client.http.props.appName…
Error message
spring.application.name or shenyu.client.http.props.appName must not be empty
What it means
When registering Spring MVC endpoints to ShenYu admin, the client needs an application name. The starter requires that at least one of `spring.application.name` or `shenyu.client.http.props.appName` is set; if both are blank it refuses to create the ShenyuSpringMvcClient event listener bean.
Solutions
- Set spring.application.name in application.yml/properties
- Or set shenyu.client.http.props.appName in the client config
- If set via environment variable/profile, verify the profile that activates it is actually loaded
Example fix
// before
spring:
application: {}
// after
spring:
application:
name: my-http-service Defensive patterns
Strategy: validation
Validate before calling
if (StringUtils.isBlank(env.getProperty("spring.application.name"))
&& StringUtils.isBlank(props.getProperty("shenyu.client.http.props.appName"))) {
throw new IllegalArgumentException("Provide spring.application.name or shenyu.client.http.props.appName");
} Try / catch
try {
applicationContext.register(ShenyuSpringMvcClientConfiguration.class);
applicationContext.refresh();
} catch (IllegalArgumentException | BeanCreationException e) {
if (e.getMessage() != null && e.getMessage().contains("must not be empty")) {
log.error("Set spring.application.name before enabling the ShenYu MVC client");
} else throw e;
} Prevention
- Always set spring.application.name in every Spring Boot service
- Keep appName consistent between dashboard registration and client props
- Verify active profiles supply the property in CI and production
When it happens
Trigger: Starting a Spring MVC service with shenyu-spring-boot-starter-client-springmvc on the classpath while neither spring.application.name is defined in the environment nor appName is present in shenyu.client.http.props.
Common situations: Newly scaffolded Spring Boot app missing application.yml's spring.application.name; copying client config from a dashboard example that omitted props.appName; running multiple app variants where the name was intentionally externalized but never provided.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- -114
- Acquire Timeout value must be positive
- apiKey must not be empty
- appPath exist under those namespace!
- At least one certificate is required
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/4c242d1c2866cf06.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springmvc/src/main/java/org/apache/shenyu/springboot/starter/client/springmvc/ShenyuSpringMvcClientConfiguration.java:77
*
* @param clientConfig the client config
* @param shenyuClientRegisterRepository the shenyu client register repository
* @param env the env
* @return the spring mvc client event listener
*/
@Bean
@ConditionalOnMissingBean(ClientRegisterConfiguration.class)
public SpringMvcClientEventListener springHttpClientEventListener(final ShenyuClientConfig clientConfig,
final ShenyuClientRegisterRepository shenyuClientRegisterRepository,
final Environment env) {
ClientPropertiesConfig clientPropertiesConfig = clientConfig.getClient().get(RpcTypeEnum.HTTP.getName());
Properties props = Optional.ofNullable(clientPropertiesConfig).map(ClientPropertiesConfig::getProps).orElse(null);
String applicationName = env.getProperty("spring.application.name");
String discoveryMode = env.getProperty("shenyu.discovery.type", ShenyuClientConstants.DISCOVERY_LOCAL_MODE);
if (Objects.nonNull(props)) {
String appName = props.getProperty(ShenyuClientConstants.APP_NAME);
if (StringUtils.isBlank(appName) && StringUtils.isBlank(applicationName)) {
throw new IllegalArgumentException("spring.application.name or shenyu.client.http.props.appName must not be empty");
}
if (StringUtils.isBlank(appName)) {
props.setProperty(ShenyuClientConstants.APP_NAME, applicationName);
}
String contextPath = props.getProperty(ShenyuClientConstants.CONTEXT_PATH);
if (StringUtils.isBlank(contextPath)) {
props.setProperty(ShenyuClientConstants.CONTEXT_PATH, String.format("/%s", applicationName));
}
props.setProperty(ShenyuClientConstants.DISCOVERY_LOCAL_MODE_KEY, Boolean.valueOf(ShenyuClientConstants.DISCOVERY_LOCAL_MODE.equals(discoveryMode)).toString());
}
return new SpringMvcClientEventListener(clientConfig, shenyuClientRegisterRepository, env);
}
/**
* ClientRegisterConfig Bean.
*
* @param shenyuClientConfig shenyuClientConfig
* @param applicationContext applicationContextView on GitHub (pinned to 567142e072)