- Spring boot
- Bean validation
- Content Negotiation
- in header send
Accept = "application/xml"
, then the response should come in xml
- in header send
- Internationalization
- in header send
Accept-language = "US"
- in header send
- HATEOAS
- SWAGGER
- Actuator
- http://localhost:8080/actuator
- http://localhost:8080 (this should show HAL browser after maven dependency is added)
- 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
- refer controller
ContactVersionController
- uri versioning
- parameter versioning
- header versioning
- http://localhost:8080/address/header
- and pass
API-VERSION = 2
in the header
- accept header version/mime type (content negotiation or accept versioning) using accept in header
- http://localhost:8080/address/produces
- and pass
Accept = application/com.venkyms.app-v1+json
- refer controller
- 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
- http://localhost:8080/h2-console
- jdbc url
jdbc:h2:mem:testdb
- on querying user, data should be shown
- create UserRepository, TweetsRespository, UserJPAResource and use the h2 data
- Add