resful-web-services

  • Spring boot
  • Bean validation
  • Content Negotiation
    • in header send Accept = "application/xml", then the response should come in xml
  • Internationalization
    • in header send Accept-language = "US"
  • HATEOAS
  • SWAGGER
  • Actuator
  • Static Filtering
    • filter parameters from sending back in the response
    • see StaticFiltering, StaticFilteringModel
  • Dynamic Filtering
    • Filter parameters dynamically using MappingJacksonValue
    • see DynamicFiltering, DynamicFilteringModel
  • Versioning API
  • Basic Authentication with spring security
    • add spring-security-starter in dependency, and restart the server. Now all request should fail with 401 error
    • restart the server and look for Using generated security password:, this will give the autogenerated password.
    • pass this in authorization tab, with Basic Auth, user and password as one generated while start of the server
    • you can also configure default username password in application.properties
      • spring.security.user.name=
      • spring.security.user.password=
  • JPA
    • Add spring-boot-starter-data-jpa dependency and here I am using H2 in-memory DB
    • Add below properties in application.properties
      • spring.jpa.show-sql=true
      • spring.h2.console.enabled=true
    • modify User class to entity class and restart, this should create a User table for the entity class
      • create a data.sql file to feed some data, and restart
    • verify the data in h2 using h2-console
    • create UserRepository, TweetsRespository, UserJPAResource and use the h2 data