Spring mockMvc doesn't consider validation in my test

后端 未结 3 1531
傲寒
傲寒 2020-12-09 10:03

I am trying to set up an integration testing with mockMvc, and i have a problem with it. Indeed, spring doesn\'t integrate any validation annotation.
For more precisio

3条回答
  •  难免孤独
    2020-12-09 10:27

    If you are using hibernate version 5.4.1.Final just add below dependency for your test

    
        org.glassfish
        javax.el
        3.0.0
    
    

    This dependency is "provided" dependency. You can find matching dependency for you version of hibernate at maven site. https://mvnrepository.com/artifact/org.hibernate/hibernate-validator/5.4.1.Final

    For example if you are using 5.4.1 version go to above link and check for provided dependencies and use it.

提交回复
热议问题