Category "java"

Download pdf from restful web services

I am writing a rest service which will download the pdf when user access this service on users machine. below is the code of my controller class. When I tried

Java Heap Space error while writing a program for Square root of an Integer

I am trying to find out the square root of an integer, but in case the integer value is too large for instance - 2147395599. Then the following program gives th

Dynamically change data source connection at runtime in Spring Boot

I have a spring-boot application with one database. Now I would like to integrate the possibility to copy some data from this database to another database. The

Create multiple threads by extending Thread class that share same object in Java

I was going through basics of multithreading and was writing a program to understand the difference between using the 2 approaches of creating threads. I have r

How to add the username and passwords to a request in java spring

I'm currently trying to add security to my spring application and just want to know how can i add the credentials to the request so that it has the security acc

Is it possible to get the return value and method arguments from the same advice in Spring AOP?

Is it possible to get the return value and method arguments from the same advice in Spring AOP? I am trying to implement some login based on return value and th

Check user role in Thymeleaf using Webflux security

I have a Spring Security 5 Reactive Applications using the "@EnableWebFluxSecurity" annotation.For my frontend I am using Thymeleaf.Now I have the problem that

Hide system navigation bar when show DialogFragment

My app is in sticky immersive mode that the system navigation bar (I call it SNB) is hidden in running time of my app. It works well but exists one problem, it

eclipse is not using application.yml

application.yml server: port: 9001 application.properties server.port= 9001 code works when I use .properties file but when I am using .yml file no propert

How to separate files, number wise using regular expressions in java/shell?

I want to separate below numbers like as(00 to 04, 10 to 14, 20 to 24) 00000000000 00000000001 00000000002 00000000003 00000000010 00000000011 00000000012 00000

MS Graph SDK for Java failed to upload large Word files

We are having problem uploading large Office files (Word, Excel) to Teams using MS Graph SDK for Java. Just wondering if anyone experienced the similar issue. H

My HMACSHA256 signature validation almost works but not quite

I wrote a method that takes a JWT as a request and checks if the signature is valid. This is the unit test: @Test public void isValid() { final JwtValidator

Is it possible to convert a Scratch project to an Android app?

For those of you who don't know, Scratch (scratch.mit.edu) is a programming language based around connecting 'blocks' of code in order to create a project. I h

Spring boot + Kotlin + MongoDb: Cannot resolve reference to bean 'mongoTemplate' while setting bean property

I am trying to make a simple application using kotlin and spring boot which connects to mongodb and makes some operations there, however I am facing this issues

How to initialise Google drive using GoogleCedentials instead of the deprecated GoogleCedential

I have java code to connect to google drive using a service account, this works: JsonFactory JSON_FACTORY = new GsonFactory(); GoogleCredential credential = Go

@Size annotation doesn't seem to work for my class

I have a Spring Boot Controller with an endpoint that accepts the following Configuration class (as json). The class has the param maxIterations and has a @Size

No qualifying bean of type 'org.springframework.kafka.core.ProducerFactory<java.lang.Object, java.lang.Object>'

I use this kafka configuration with spring cloud and spring boot 2.6.6: @Configuration @RefreshScope public class KafkaProducerConfig { @Bean(name = "nativeP

Connect Weblogic server to Eclipse Error: "does not contain a valid WebLogic Server install or the installed version is not supported"

I'm trying to connect a weblogic server to my eclipse (photon) and I keep getting this error message: Error "does not contain a valid WebLogic Server install or

Cant connect Java to MariaDB

I cant connect java to MariaDB .I saw all similar questions answers but none has solved my problem. Here is my code : /** To change this license header, choose

How to fix/ learning help understanding basic method and classes, Java code and word Problem

I'm struggling on this problem, given that I'm probably making a basic mistake or I haven't got a clue what I'm doing. platform being a Zybook the problem rea