{"record":{"id":"4c242d1c2866cf06","repo":"apache/shenyu","slug":"spring-application-name-or-shenyu-client-http-props-appname","errorCode":null,"errorMessage":"spring.application.name or shenyu.client.http.props.appName must not be empty","messagePattern":"spring\\.application\\.name or shenyu\\.client\\.http\\.props\\.appName must not be empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"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","lineNumber":77,"sourceCode":"     *\n     * @param clientConfig                   the client config\n     * @param shenyuClientRegisterRepository the shenyu client register repository\n     * @param env                            the env\n     * @return the spring mvc client event listener\n     */\n    @Bean\n    @ConditionalOnMissingBean(ClientRegisterConfiguration.class)\n    public SpringMvcClientEventListener springHttpClientEventListener(final ShenyuClientConfig clientConfig,\n                                                                      final ShenyuClientRegisterRepository shenyuClientRegisterRepository,\n                                                                      final Environment env) {\n        ClientPropertiesConfig clientPropertiesConfig = clientConfig.getClient().get(RpcTypeEnum.HTTP.getName());\n        Properties props = Optional.ofNullable(clientPropertiesConfig).map(ClientPropertiesConfig::getProps).orElse(null);\n        String applicationName = env.getProperty(\"spring.application.name\");\n        String discoveryMode = env.getProperty(\"shenyu.discovery.type\", ShenyuClientConstants.DISCOVERY_LOCAL_MODE);\n        if (Objects.nonNull(props)) {\n            String appName = props.getProperty(ShenyuClientConstants.APP_NAME);\n            if (StringUtils.isBlank(appName) && StringUtils.isBlank(applicationName)) {\n                throw new IllegalArgumentException(\"spring.application.name or shenyu.client.http.props.appName must not be empty\");\n            }\n            if (StringUtils.isBlank(appName)) {\n                props.setProperty(ShenyuClientConstants.APP_NAME, applicationName);\n            }\n            String contextPath = props.getProperty(ShenyuClientConstants.CONTEXT_PATH);\n            if (StringUtils.isBlank(contextPath)) {\n                props.setProperty(ShenyuClientConstants.CONTEXT_PATH, String.format(\"/%s\", applicationName));\n            }\n            props.setProperty(ShenyuClientConstants.DISCOVERY_LOCAL_MODE_KEY, Boolean.valueOf(ShenyuClientConstants.DISCOVERY_LOCAL_MODE.equals(discoveryMode)).toString());\n        }\n        return new SpringMvcClientEventListener(clientConfig, shenyuClientRegisterRepository, env);\n    }\n\n    /**\n     * ClientRegisterConfig Bean.\n     *\n     * @param shenyuClientConfig shenyuClientConfig\n     * @param applicationContext applicationContext","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/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#L59-L95","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nspring:\n  application: {}\n// after\nspring:\n  application:\n    name: my-http-service","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(env.getProperty(\"spring.application.name\"))\n        && StringUtils.isBlank(props.getProperty(\"shenyu.client.http.props.appName\"))) {\n    throw new IllegalArgumentException(\"Provide spring.application.name or shenyu.client.http.props.appName\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    applicationContext.register(ShenyuSpringMvcClientConfiguration.class);\n    applicationContext.refresh();\n} catch (IllegalArgumentException | BeanCreationException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"must not be empty\")) {\n        log.error(\"Set spring.application.name before enabling the ShenYu MVC client\");\n    } else throw e;\n}","preventionTips":["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"],"tags":["spring-boot","configuration","client-registration","shenyu"],"backgroundTag":"missing-required-config-field","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}