Ankeet's backend garden


  • [application] + [configuration] = app

  • [Configuration] class is present in every dropwizard app and its values come from a yaml file

  • [[jersey resources]] are the controllers of a dropwizard app

    • they are classes that can be scoped to serve urls
    • they can get GET, POST etc methods inside that
    • [doubts] what's [[jersey]]?
    • before they start working you have to register the resource - no automatic scanning of annotations I guess
    public void run(HelloWorldConfiguration configuration,
    Environment environment) {
    final SomeResource resource = new SomeResource();
    // do this multiple times :/


    • using @Valid annotation - JSR 303 I think, it can automatically return the correct code to client
    • you can also use ConstraintViolations to programmatically map through the violations and do something about it
    • also it supports both javax.util.validation and Hibernate Validators

    coding best practises

    • if you need to give out clients; it's best to separate the representations i.e. the objects entities in one single package or folder
    • then another for client which uses a web client and connects to the server
    • server contains the actual logic - it contains the jersey resources
    • all of the external connections like DB etc need to come via yaml file which is parsed to the [configuration] class object and the app can use it with environment maybe in the run method