Spring Rest ErrorHandling @ControllerAdvice / @Valid

前端 未结 3 498
傲寒
傲寒 2020-12-30 03:29

I\'m having trouble when Using @ControllerAdvice and @Valid annotations together in a REST controller.

I have a rest controller dec

3条回答
  •  不思量自难忘°
    2020-12-30 03:52

    In addition to this I had another problem on recursive validation.

    The generated classes were missing a @valid annotation on the other XmlElements.

    The reason for this is related to the fact that I was wrongly using the namespaces:

    The plugin is configured to use a particular namespace

    -XJsr303Annotations:targetNamespace=http://www.foo.com/bar
    

    So the XSD need to have this as target namespace (e.g.):

    
    
    
        
            
                
                
            
        
    
        
            
                
            
        
    
    
    

    Kind regards Antonio

提交回复
热议问题