Skip to content

[HAL Explorer] All buttons except GET are disabled by default #2060

@djkeh

Description

@djkeh

Hi,

Starting from Spring Boot 2.5, all buttons in HAL Explorer except GET are disabled at the first time.

Reproducing the problem

  1. Initialize Spring Boot project at https://start.spring.io/ including following dependencies:
    • spring-boot-starter-data-jpa
    • spring-boot-starter-data-rest
    • spring-boot-starter-web
    • spring-data-rest-hal-explorer
    • h2 database
  2. Make a single entity class and its repository implementing JpaRepository
  3. Run Spring Boot application
  4. See HAL explorer web page

The cause of this problem

According to toedter/hal-explorer#28, This is intended behavior for hal explorer as the data rest api responds with the Content-Type: application/hal-forms+json. However, it seems we don't have a workaround for this problem like forcing response content type to application/hal+json. We have a spring boot property named spring.data.rest.default-media-type, but it takes no effect.

We have to give some option for HAL explorer to request certain content-type of the api endpoints like forcing Accept header, so that the HAL explorer recognizes the endpoint properly and shows every button like it used to do before spring boot version 2.5.

This is first mentioned in #2017

Thanks.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions