我猜答案是否定的,因为文档中所有对Bean验证的引用都与服务器端有关。
客户端是否支持Bean验证?这样我就可以在将实体发送到服务器之前对其进行验证。
我认为这个问题应该很容易解决,但我正在拉我的头发。我有以下 docker-compose:
version: "3"
services:
pg-db:
image: postgres:11
environment:
POSTGRES_PASSWORD: "postgres"
POSTGRES_USER: "postgres"
POSTGRES_DB: "postgres"
ports:
- 5432:5432
#network_mode: host
Run Code Online (Sandbox Code Playgroud)
然后我运行docker-compose up并启动容器
pg-db_1_78e7ec4a95e6 | 2020-02-21 13:53:53.928 UTC [1] LOG: database system is ready to accept connections
Run Code Online (Sandbox Code Playgroud)
我可以用 docker exec 连接到它
docker exec -it docker_pg-db-compose_1_78e7ec4a95e6 psql -h pg-db -U postgres postgres
Run Code Online (Sandbox Code Playgroud)
但是我无法通过“裸” psql 连接到它:
psql postgresql://postgres:postgres@localhost:5432/postgres
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432? …Run Code Online (Sandbox Code Playgroud)