I have a REST Controller in my Spring Boot application as follows: Upon trying to start the application, I get the following error: Upon changing the endpoints(in the getmapping part), this works perfectly. I fail to understand that since it does not recognise one with query param and one without as 2 separat…
Tag: spring-boot
Spring boot hibernate complex table relationship works partially
I have following models they have one-to-one and one-to-many and many-to-one relationship. Most of the model are fine except one. My json data: Java models: After inserting data in H2 DB, I can see flowing tables and data. Car: Vehicle: Location: As you can see all data is fine except Location. It has missing…
How to send Email in Java without DB setting [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question I have set up a simpleMailMessage service following the codes and information given from sprin…
Kotlin CLOB to String
I have a function in Oracle that returns a CLOB. In Java I can use the following code to execute this function and fetch the result: Oracle function definition in my Repository class: Conversion to String: What’s the equivalent code in Kotlin or any other way to convert the Clob to String? Answer ItR…
Validation failed for query in tests but not in production
Problem description I have the following test class with a few tests. The setUp() method executes insert statements from a file. The first test simply makes a post request and expects an array of JSON objects in return with a 200(OK) status: Upon running the first test I get the following error: What I Tried …
Error when trying to set up JDBC connection with local MYSQL database in Java 17 with a spring boot project
My project is generated/downloaded from: https://start.spring.io/ I am now trying to connect to my local MYSQL database which actually has data in it and is fully functional. To do this I am using a springboot project where I want to set up a jdbc connection, as I was able to do before in Java 8. But now when…
Cannot be resolved to absolute file path because it does not reside in the file system
My Code: I have already tried instead of .getFile(), extractJarFileFromURL or resource.getInputStream() but all this does not work. When I package my project and run it as a jar file and it tries to open the following file it always returns the following message. Error: java.io.FileNotFoundException: class pa…
Spring Boot unable to set global date format for REST API input
I am trying to set a global format for date-time, so that I don’t have to annotate each and every method or on DTO fields. I have tried to configure it globally, the only impact it had was on API response, it is formatting the date in specific pattern. But it does not accept it as an input format. Excep…
testing code with a “real” Thymeleaf template engine and nothing else
In my Spring Boot project (v2.6), one of my components is using a Thymeleaf template engine to generate content. I want to unit test my component, but I am struggling because it has a TemplateEngine as a constructor dependency : I don’t want to mock the TemplateEngine (the test would not have great valu…
Spring Boot CrudRepository not saving entities to my database
I’ve been at this for a few hours now and can’t seem to find the issue. For a bit of context, here is my database schema : Here is my Student class : And here is my Task class : My H2 Database structure therefore looks like this : I am trying to add a task to a student through