When we using methods that come from JpaRepository like save, in which database spring boot use? and how can we change the default database if necessary? Answer It uses the database which you have configured in your properties file. You can change the database using the following properties(MySQL example):
Tag: java
Running unit tests with Spark 3.3.0 on Java 17 fails with IllegalAccessError: class StorageUtils cannot access class sun.nio.ch.DirectBuffer
According to the release notes, and specifically the ticket Build and Run Spark on Java 17 (SPARK-33772), Spark now supports running on Java 17. However, using Java 17 (Temurin-17.0.3+7) with Maven (3.8.6) and maven-surefire-plugin (3.0.0-M7), when running a unit test that uses Spark (3.3.0) it fails with: ja…
spring boot app works on intellij but not with .jar file
I am new to Spring boot and java. I have a simple Spring boot app which has one function. When I run it on intellij it works well, and I am able to test it with postman many times without issue. But when I build an artifact and then .jar file, running that .jar file will close the program immediately.
Java Sort List Based Off Intersections
I’m trying to see how I can sort a list using streams where items that exist in a separate hashset are moved to the front of the list. Example: I’m assuming I can use a lambda in streams.sorted() for this but I’m not able to figure out what this would look like. Answer You can compare the bo…
How To Convert Spring Boot Entity to Angular Object
I’m trying to use Angular and Spring Boot to show a list of Rule objects. I am not using a JPA Repository to respond to the GET request, so I think I have to ‘manually’ convert my list of Rule objects on the Spring Boot side to a JSON so that httpClient.get<Rule[]>() can convert it to …
How does java dialog inheritance work? I lose some properties
Sorry I don’t have much knowledge about Java or swing applications. I created a dialog called DlgShape and in it i have 2 text fields, 2 buttons and 2 labels. I tried creating DlgRectangle and instead of it inheriting from JDialog I inherited from DlgShape. The design of the parent and child class are i…
Why are Spring libraries including same parent packages made seperate?
I’ve just noticed two different libraries sharing paths. Example is as follows. There are two seperate packages – spring-boot-actuator, spring-boot-actuator-autoconfigure. Packages included in these libraries share the same parent package or package path. I can’t imagine the things under the…
Can I use Gmail API send email without Google Workspace (or Service accounts)?
I want to use Gmail API to send email in JAVA,and all information I fond told me to create a Service accounts and connect with Google Workspace. But I don’t have a Google Workspace account also can’t register one,so the question is: 1.Can I send email without Google Workspace? 2.Can I just Add …
how to set docker image name as a file name it creates while building
So i want to set the docker image name as a file it creates. the stages inside the dockerfile are: set new version for pom.xml, compile, package all using mvn. i want to set the docker image name as the artifact the build creates Example: my-app-1.0.1 Thanks! Answer So as Thorbjørn Ravn, Andersen and Max advi…
Scanner for hex-input not working as expected inside loop
I need to solve this problem where i need to convert hexadecimal numbers to decimals. Issue I have compiled it without any errors, but my output came out wrong. Can someone show how to fix these errors? Code Example Input: Expected Output: Output that i got: Answer Your solution is close. Here are changes to …