Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully Expanded Arguments to Config WeightRoutePredicate always occur empty error #3640

Open
sunhao1256 opened this issue Dec 13, 2024 · 0 comments

Comments

@sunhao1256
Copy link
Contributor

Describe the bug
Fully Expanded Arguments for WeightRoutePredicate always occur empty error in startup procedure

Sample
spring-cloud-starter-gateway:4.0.7

  cloud:
    gateway:
      routes:
        - id: weight_high
          uri: http://localhost:8001
          predicates:
            - Path=/weight
            - Weight=/
            - name: Cookie
              args:
                name: mycookie
                regexp: mycookievalue
            - name: Weight
              args:
                weight: 8
                group: 'group1'

error msg:

   - Field error in object 'weight' on field 'group': rejected value [null]; codes [NotEmpty.weight.group,NotEmpty.group,NotEmpty.java.lang.String,NotEmpty]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [weight.group,group]; arguments []; default message [group]]; default message [不能为空]
    at org.springframework.boot.context.properties.bind.validation.ValidationBindHandler.validateAndPush(ValidationBindHandler.java:141)
    at org.springframework.boot.context.properties.bind.validation.ValidationBindHandler.validate(ValidationBindHandler.java:114)
    at org.springframework.boot.context.properties.bind.validation.ValidationBindHandler.onFinish(ValidationBindHandler.java:105)
    at org.springframework.boot.context.properties.bind.Binder.handleBindResult(Binder.java:368)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:349)
    ... 59 common frames omitted
2024-12-13 17:50:28.863 ERROR [/] [-main-] c.a.g.l.RefreshRoutesResultEventListener : refresh routes error org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'weight' to org.springframework.cloud.gateway.support.WeightConfig
2024-12-13 17:50:34.006  INFO [/] [-main-] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-12-13 17:50:34.063 ERROR [/] [-main-] o.s.b.d.LoggingFailureAnalysisReporter : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Binding to target org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'weight' to org.springframework.cloud.gateway.support.WeightConfig failed:

    Property: weight.group
    Value: "null"
    Reason: 不能为空


Action:

Update your application's configuration```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant