- The below plugin dependencies are the ones responsible for treating this project as a spring boot project.
plugins {
id 'org.springframework.boot' version '2.2.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
- Junit5 information is available in this link
- This is the kind of testing where you slice the application context and use that for your test
@WebMvcTest // This just tests the controller later
- More info about slice based annotations are available in the below link.
- Add the below dependency for the actuator.
implementation 'org.springframework.boot:spring-boot-starter-actuator'
- More info about actuator is available in the below link.
-Customizing the default actuator behavior
management:
endpoints:
enabled-by-default: true
web:
exposure:
include: "*" # This exposes all the endpoints to the actuator
base-path: "/manage" #This is the base endpoint for the actuator.
- This works only for the RestTemplate.
- If you using Spring WebClient then use WireMock or OkHttps's MockWebServer
- The below configuration displays the sql queries with the bind parameters in the console.
spring.jpa.show-sql: true
logging.level.org.hibernate.SQL: debug
logging.level.org.hibernate.type.descriptor.sql: trace