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

Hotswap file not found error. Running works fine.

My Project runs just fine. Even the "missing" code works. But when I want to hotswap it fails with errors like this one with a lot of files. /home/spieler/IdeaProjects/BBsentials-Server/main/src/main/java/de/hype/bbsentials/server/discord/events/staticimplementations/commands/commands/development/TestDiscordCommand.java:17: Fehler: Failed to parse source file: src/main/java/de/hype/bbsentials/server/discord/events/staticimplementations/commands/commands/development/TestDiscordCommand.java (Datei oder Verzeichnis nicht gefunden) public class TestDiscordCommand extends AbstractSingleCommand { ^...

Jwt Auth Issue

```@Configuration @EnableWebSecurity public class SecurityConfiguration { @Autowired...

How I make Spotless follows my checkstyle configuration?

I have some annoying conflicts between Checkstyle and Spotless and I dunno what is the best approach to do ?

VS Code Setting

This may seem silly but it's been really annoying to deal with for a while now. Whenever I use overloaded methods (for example the println or the add method on ArrayList) that can have either different type or number of arguments, I get this box (see image) that lets me arrow between different versions. Does anyone know how to remove this? It takes priority on up/down arrow keys which makes moving between lines of code very frustrating since I frequently use the arrow keys to navigate my code. L...
No description

Should mock objects be in a single class?

Hey so should different mock objects be in a single class for different tests? is this good practice? or should they be in their respective test classes

How to get built jar during test-time (JUnit)

I'm making an integration testing framework for Minecraft plugins which uses JUnit. My plan is to send a built plugin file during test-time to a docker container, which in term runs a server with that specific plugin file, which will be loaded using the servers class loader. This file should not include test resources The problem I'm facing is that there's large differences in buildscripts for projects; it would not be feasible to just run something like ./gradlew build and retrieve the file from it's directory, as there's also maven, and multimodule projects and much more that I don't know about. What is the least painful approach to generate or fetch this file?...

Scanner Bug (Tried Everything)

So I ask users through input through these two methods: ```java public static String whileLoopInputString (Predicate<String> checkCase, String inputMessage, String errorMessage, Scanner scanner) { String input = ""; ...

stripe dependency not being recognized?

for some reason I keep getting errors here
No description

How to define 3 authentication ways config - httpBasic, userDetailsService, JsonLoginFilter()

I'm creating an app where a user can authenticate using three ways httpBasic, userDetailsService, JsonLoginFilter(). A user should be authenticated using Spring's default /login path. But the type is one of three: httpBasic: There must be 2 users in memory database for testing. Simple user with user role and admin user with its role. ...

Help me with spring JDBC

Hello, I'm using spring data JDBC to manage two entities, but I am getting a rather strange exception when testing the UserRepository. Spring is trying to map the "users_key" attribute of the "expense" table, but this attribute is nonexistent. I'm sure the core problem is in the mapping of the "expense" attribute of the User entity, because when I annotate the attribute as @Transient, the exception doesn't occur. Below are the images of the entities, the SQL script to generate the tables, the test code, the repository and the stack trace...
No description

production vs development

is it necessary to change the structure of db while in production? as i was not getting a single exception and was working fine in development but when i deployed it, Db has started giving me errors

What is the meaning of lazy-initialization in Spring Boot properties file ?

In one of our projects in company. A teammate did this long time ago, and I don't get why ? The property documentation says :
Whether initialization should be performed lazily. - default value is false
```yml spring:...

Trying to connect to MS Access

I'm trying to connect to MS access and keep getting the following error:
No description

fetch subclasses and their associations with one query

demo for simplicity and to avoid being sued :GnuTrolling: so the question is whether its possible to fetch all the associations to their respective classes when calling the find all method without eager fetching and avoiding n+1 and without extra queries for getting the associations...

What are the initial values of the primitives that are encapsulated in an object?

What are the initial values of the primitives that are encapsulated in an object, and what are the initial values of the primitives that are not encapsulated in an object?

Can spring @autowire one of the parameters in a constructor and not autowire the other one?

I mean that if I say new TestObject(autowirethis, notautowirethisbutinitiateit); can i make it so i provide one of the values and dont provide the other one?

403 error issue

```@RestController @RequestMapping("/api/auth") public class SignUpAndLoginController { @Autowired...
No description

POST Request blocked by CORS, alrdy allow CORS, spring boot with react project

I'm Working on mockup e-commerce use react and spring boot, and I got stumble on register page. Been trying to make api call to spring boot but got blocked by CORS policy, it quite strange bcz I already allow my local url on CORS policy before (got blocked by CORS when try to GET data from api, but fixed it) and somehow when I try to make POST request it got blocked. here my repo: https://github.com/W-ptra/dummyShop register page: https://github.com/W-ptra/dummyShop/blob/main/frontend/src/pages/Register.tsx...
No description

Java tech questions

Hi I have one question I’ll use this opportunity here, how does one get good at job interview technical tests it seems like these hacker rank and leet code style questioning people have this natural talent to solve the problems is it something they picked up along studying or they just have intuition without prior study of Data structures and algorithms or leet code and hacker style questioning because I feel like I’m kind of cheating looking at other people’s videos to understand and not challe...