Docker compose How to run local pubsub inside docker? Here is a docker compose file that will: pull in the google/cloud-sdk:emulators image initialize the project with id test-project-id create topic with name test-v1-topic create subscription with name test-v1-subscription version: '3.8' services: pubsub-emulator: image: google/cloud-sdk:emulators container_name: pubsub-emulator ports: - "8085:8085" command: gcloud beta emulators pubsub start … Continue reading Local pubsub emulator via docker compose && Spring Boot
Author: Dimitar
Keycloak docker KC_ variables ignored?
I have been using the `quay.io/keycloak/keycloak:19.0.3-legacy` with docker compose and JHipster. Now, JHipster application exposes UI to 8080, keycloak also exposes to 8080, so we map it to another port, say 9080. JHipster app talks to the keycloak via service name and port, like so: keycloak:8080, and all works fine until you try to login, … Continue reading Keycloak docker KC_ variables ignored?
Spring JPA – Delete by multiple values
After, apparently, encountering a JPA bug with delete all by in the repository, I had to figure out the best approach to run a delete by query. Using named query on the entity seems to work just as expected, so I am posting the link to the solution here as a reference: https://medium.com/the-full-stack-developer/how-to-delete-records-in-spring-data-based-on-multiple-values-563500ad51cc
Hibernate JPA and PostgreSQL: change type from String to text (@Lob)
In existing table with data populated, changing the column type from string to text requires some migration. For large data type, Postgres stores the data in a separate location and just references it by using an ID. This means that, until then, column data would be a string content and after the change, it would … Continue reading Hibernate JPA and PostgreSQL: change type from String to text (@Lob)
Vuetify radio button, align label left
Just a quick CSS hack to align the radio button label to the left of the radio button... https://stackoverflow.com/questions/220273/how-can-i-reorder-my-divs-using-only-css In the Vue code: <style> .v-input--selection-controls__input { order: 2; } </style>
Failing tests with: InvalidDefinitionException: Java 8 date/time type `java.time.Instant` not supported by default
If issue is in the mock mvc tests, then just register module to object mapper... ObjectMapper o = new ObjectMapper(); o.registerModule(new JavaTimeModule());
Liquibase SpringBoot Multiple Data Sources
I was working on an example of how to get Liquibase with SpringBoot and multiple databases working. After some documentation and reading stackoverflow, here it is, for a future reference: https://github.com/divukman/liquibase_spring_boot_example
Spring REST – returning image or a file
Just an example of how to return an image or a file from a rest controller. Idea can be to proxy image call or just to return a file. @GetMapping(value="/scans/{id}/{image}", produces = MediaType.IMAGE_JPEG_VALUE) public ResponseEntity<?> getScanImage(@PathVariable String id, @PathVariable String image) { final byte[] imageBytes = bucketApi.readScan(UUID.fromString(id), image); return new ResponseEntity<>(imageBytes, HttpStatus.OK); } @GetMapping(value="/scans/stream/{id}/{image}", produces … Continue reading Spring REST – returning image or a file
gRPC Spring Boot Server with Oauth2 (Keycloak)
This post will describe, in shortest steps, the configuration needed to get spring boot grpc server secured with oauth2 tokens, in my case with Keycloak. Resources: OAuth 2.0 Resource Server JWTgRPC Spring Boot StarterServer security configurationPostman gRPC My demo project can be found at github. Server code has been updated to have all the configuration … Continue reading gRPC Spring Boot Server with Oauth2 (Keycloak)
Hexagonal Architecture With SpringBoot
I have been trying to create a clean hexagonal architecture example with SpringBoot. More complex approaches are possible, by introducing the CQRS into the equation, but I believe that just over complicates the architecture and if there is no really good reason for it, I'd avoid it. There are a couple of examples out there … Continue reading Hexagonal Architecture With SpringBoot