Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

We are a Community full of Java developers. Connect with other devs, get help, help others and do much more!

Join

java-help

❓︱qotw-answers

Urgent Help PLS

I need some help in terms of separating the code into new files for each question, like all my answers are on one file and i cant seem to get it working separately on each file i have attached a brief in terms of what the answers need to fulfil ive attached my code too...
No description

I need something faster than BigInteger.probablePrime

i have an method: ```java public SSPSharedPair createSharedPair() { // slow method Timer timer = new Timer() {{ this.run(); }}; ...

Difference between OOPS Inheritance and JPA's Inheritance?

I have two Jpa entity,which share 80% columns ,so I was hoping to make a common Oops class extend it to 2 child inherited class. But , JPA Entity also has the inheritance property. Is there any right or wrong approach to it ?...

how to generate and use java files in generated sources properly

i have this code snipped ``` // Write to target/generated-sources/com/asdru/oopack/Version.java JavaFile javaFile = JavaFile.builder(packageName, enumType) .build();...

Spring RabbitMQ - How to perform application recovery, on RabbitMQ reconnection

I connect to RabbitMQ through a CachingConnectionFactory. This has a simple, built in - forever retry mechanism to recover. To support dynamic queue management (creation, listening via API), I manipulate the RabbitListenerEndpointRegistry registry; When the connection to RabbitMQ is interrupted (any network outage), the recovery mechanism is successful. However, the registry is initialized, by Spring. I have been unable to find a place to hook into the reconnection flow, such that I can rebuild my registry on reconnection. The registry is leveraged by a single @RabbitListener...

Why is OpenJDK ~50 MB larger than Eclipse Temurin?

I downloaded both and compared the folder sizes, why is this the case? Thanks!

Is this Armstrong number checking code perfect for 3 digits?

public class wow { public static void main(int n) { if (n>=100 && n<1000) { System.out.println("Number selected: "+n); int a=n%10;...

Generic service for CRUD operations

In my Spring Boot project, I want to have a single service class for generic CRUD that can handle any entity, not to extend it, just to call it from controllers indicating entity, repository and DTO (Or something like this) the main idea is to have a single service class to CRUD to all entities, if the entity have unique or different behavior I will separate it in other service e.g. user authentication. Reference the entities, repositories and DTOs outside the CRUD service. Doing this to not rep...

Problem with Spring Security

Hello, I would be grateful for help I do the logic that when users were registered immediately and in the keycloak also were created, so here is the problem encountered that the method /api/v1/users/user, to which I explicitly indicated that permitAll() still requires authorisation, please tell me how to be, thank you in advance. Here I made another pure get method to test whether permitAll() was applied at all and everything works fine....
No description

Access denied for 'user'@'host' in Dokcer container

I created a development environment with Docker for my Spring Boot project. But when I run the container I got a error like Access denied for 'latte_admin'@'localhost' (Using Password: YES). Occurs with the app and also if I run a healthcheck for the DB in the container. The project was connected without problem outside containers. I deleted containers, volumes and images and recreated they, but the issue persists. docker-compose.yml ```yml ...

avoid re-declaring constructors in superclasses

https://github.com/asdru22/OOPack/blob/main/src/main/java/com/asdru/oopack/objects/Lang.java https://github.com/asdru22/OOPack/blob/main/src/main/java/com/asdru/oopack/Objects/AssetsJson.java https://github.com/asdru22/OOPack/blob/main/src/main/java/com/asdru/oopack/Objects/JsonFile.java i have this system where i have lang that extends assets json, which extends json file. since i plan on having lots of files that extned assets json, i was hoping there'd be a better way to handle all the different constructors? i dont want to find myself having to redo all of them if i decide to change something in the base...

How to Import Library in build.gradle

I've written the url in "repositories" and "implementation('kryonet:kryonet:2.21')" in "dependecies" section, but gradle can't sync it.
No description

Terminal Review help!

Guys I have a 100 marks Computer Applications Terminal Review in about a few days. I am not so confident about the test cuz I've been trying to hard to get some codes right but I always tend to forget it. Is there a way I can learn much more efficiently?

Beginner

Hey everyone! 👋 I'm just starting out with Java and feeling a bit overwhelmed, to be honest 😅 I'm really excited to learn, but since I'm completely new, I’d love any suggestions for beginner-friendly resources—whether that’s tutorials, YouTube channels, or anything that helped you when you were starting out. Also, if anyone here wouldn’t mind being a sort of mentor or someone I can check in with when I get stuck, I’d be super grateful. Of course, I’ll do my best not to bug you too much 😊 Thanks so much in advance—I’m looking forward to learning with you all!...

Beginner

Hello everyone, I am a complete beginner interested in learning Java. How would everyone recommend I go ahead doing this?

Buidling Projects

Hi everyone...i am just going to 3rd Year of my Btech graduation....i am tired/bored of integrating Backend services in java with React/web browsers and web pages....could anyone pls advice some options where services connect to more than just a frontend React webpage which could make a good project for learning purpose and a decent project...?(thought of native but anything else will be helpful to see)

When to use protobuf/rpc vs in-built java streams?

I'm wondering what are the use cases of when to use protobuf vs in-built java streams?