Coder Social home page Coder Social logo

validator-fail-mwe's Introduction

MWE demonstrating initialization issues of Hibernate Validator

(or at least Hibernate Validator as it's used by default in springboot)

Problem

When app starts and first request is made to endpoint accepting annotated dto, it will succeed and from that point on, validation on both endpoints works.

When app starts and first request is made to endpoint accepting dto configured via XML, it will FAIL and from that point on, validation on both endpoints FAILS.

When app reaches defective state, it can be only killed and restarted(as expected).

Description

There are 2 modules:

  • module validator-fail-api, which has just custom Validator annotation definition
  • module validator-fail-app, which has all the logic.

This simulates having multi-module app with api module, which does not contain ConstraintValidator implementations.

Module validator-fail-app has 1 controller(mwe.validatorfail.controller.TestController), which accepts 2 DTOs:

  • mwe.validatorfail.dto.AnnotatedSampleDTO
  • mwe.validatorfail.dto.SampleDTO

These are 'same', just one has validations expressed via annotations, another one has them expressed via XML(validation-constraints.xml).

Root pom.xml is here used just so that you can easily build it, otherwise both app has same spring parent to 'imitate' that these modules are unrelated, without same parent.

How to invoke

in root directory:

1. mvn clean install
2. java -jar validator-fail-app/target/validator-fail-app-0.0.1-SNAPSHOT-repackaged.jar

and then invoke scripts from root, based on what endpoint you want to call:

  • callAnnotatedEndpoint.sh
  • callXmlDefinedEndpoint.sh

validator-fail-mwe's People

Contributors

martin-mucha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.