October 22, 2024
Chicago 12, Melborne City, USA
java

Setup SpringBoot Opentelemetry, exporter by zipkin, instrument with jdbc get Error

I want to add traceId automatically in log (with MDC) add spanId automatically when call redis or jdbc (I want to use opentelemetry instrumentation) exporter to zipkin my pom file <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.3.0</version> <relativePath/> </parent> </dependencies> <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-registry-prometheus</artifactId> </dependency> <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-tracing-bridge-otel</artifactId> </dependency> <dependency> <groupId>io.opentelemetry</groupId> <artifactId>opentelemetry-exporter-zipkin</artifactId> </dependency> <dependency> <groupId>io.opentelemetry.instrumentation</groupId> <artifactId>opentelemetry-spring-boot-starter</artifactId> </dependency> </dependencies> <dependencyManagement>

Read More
java

How to Resolve Circular Foreign Key Constraints with NOT NULL in Hibernate

I’m dealing with a cyclic dependency issue between two entities (Store and Staff) in MySQL, which is causing issues when trying to save data using Hibernate ORM (version 6.6.0.Final, no Spring). The problem arises from foreign key constraints and NOT NULL restrictions in the database schema. Database Schema (MySQL): Here are the relevant sections from

Read More
java

Java SpringBoot WebFlux with r2dbc cannot recognize annotation @Table and @Column

I m building a Java SpringBoot application with WebFlux. So this is my pom.xml file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>it.company.boot.omnia</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.1.0</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>it.company</groupId> <artifactId>silver-service</artifactId> <version>1.0.0</version> <description>Silver service</description> <properties> <swagger.release>1.7.0</swagger.release> <caffeine.version>3.1.6</caffeine.version> <jackson.datatype.guava.version>2.15.1</jackson.datatype.guava.version> <keycloak.version>20.0.5</keycloak.version> </properties> <dependencies> <!-- WebFlux starter --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId>

Read More
java

How is the list of items received by the ItemWriter in spring batch accumulated?

In Java Spring batch, I understand that ItemReader reads one item at a time and passes it to the ItemProcessor. Suppose my implementations are ItemReader<InputItem> and ItemProcessor<InputItem, OutputItem> and thus the ItemWriter becomes ItemWriter<OutputItem>. But the ‘write’ method takes a ‘List’ of items like so public interface ItemWriter<T> { void write(List<? extends T> var1) throws

Read More
java

Why static methods with body are applicable in interface, as it defeats the purpose of interface that method without body

Interface face means method without body, then why static methods with body are allowed in interface When static method written with body there is no error, as non static methods with body gets an error It defeats the purpose of abstraction. You need to sign in to view this answers

Read More
java

Jenkins agent as kubenetes pods with kubedock to run testcontainers getting connection refused

I have Jenkins pipeline to build and run integration tests which require docker environment to run testcontainers that create Mysql database in Kubernetes with Kubedock. Jenkins agent pod and Kubedock pods are getting created successfully however test are failling with the connection error below. [GIN-debug] Listening and serving HTTP on :2475 I1017 06:23:48.773547 1 main.go:66]

Read More
java

Create JSON request payload from extracted values inside ForEach controller

I have a list of countries using them I created my var_ variables to be used in ForEach loop controller For Each Loop – Output variable countryName Inside the ForEach loop controller – I have a JSON Extractor which is fetching the countryId,CurrencyId,countryCode on the basis of countryNames(output variable) I want to create my JSON

Read More
java

How to move from Yes to No in toggle switch using selenium java

Here i need to move from Yes to No, so please guide me how to locate xpath for toggle swithcer, and please refer below html code WebElement toggleswitch =wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@id='mfaEnabledId']/following::label[@for="switcher"]"))); toggleswitch.click(); i have used this xpath but it throws error like this FAILED: verifyUserCreaton("naresh", "123", "nareshponnusamy77@gmail.com", "Naresh123", "Naresh@14499", "Naresh@14499") org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <label for="switcher"

Read More
java

How to customize the well-known endpoint in Spring Authorization Server?

I’m using Spring Authorization Server v3.3.1. My current well-known endpoint is <hostname>/.well-known/openid-configuration and this returns the standard OpenId configuration. I want to remove a couple of attributes from this standard response and change the endpoint path to <hostname>/oauth2/token/.well-known/openid-configuration. For this I’ve duplicated the OidcProviderConfigurationEndpointFilter and made the necessary changes and registered it to the authorizationServerSecurityFilterChain.

Read More
java

Is there way to convert a 38 digit number into a String of length 18 to 20 without any special character?

I have an Use case where i need to encode 38 digit number into a string of length 18 to 20. Iam using a ByteBuffer with capacity of 16 bytes in java to store two Long values. Then i try to encode it to a string without any special characters. I tried base32 encoding which

Read More