Specifications let you define common request setup (RequestSpecification) and common response expectations (ResponseSpecification) once and reuse them across many tests, eliminating duplication.
A RequestSpecification (built with RequestSpecBuilder) bundles base URI, headers, auth, content type, and logging, then every test does given().spec(reqSpec).... A ResponseSpecification bundles shared assertions (status code, content type, response-time SLA) applied with then().spec(respSpec).... This centralizes cross-cutting config: change the base URL or auth in ONE place instead of in every test. Specs make suites DRY, consistent, and easy to point at a different environment. They're a hallmark of a mature REST Assured framework and a common interview/design question.
A base spec: RequestSpecification base = new RequestSpecBuilder().setBaseUri(URI).addHeader('Authorization', token).setContentType(JSON).build(); reused as given().spec(base) in every test, so switching environments is a one-line change.
Every test repeats the same base URI, auth header, and content type. How do you eliminate this duplication in REST Assured?