I have two files in my application. The Main class file. The controller class. My application.properties looks like : Here’s what my console looks like : I tried hitting the api with the url : http://localhost:8080/util-service/util and this throws up a 404 error. So even though the controller is picked up for component scanning(according to the logs), the request within
Tag: spring-boot
Why do I get 404 Not Found in Spring Boot
My Spring Boot application sends data through REST API. I connects to many Google Cloud components: google pubsub, mqtt server and google SQL. Since I implemented PUBSUB and MQTT, whenever I send a request from Postman I receive My pom.xml configuration looks like this I also found that request is being served by backend to the point of return, so
How create unit test in Spring REST in POST Cotroller
I have a Spring Boot Controller with POST. Method works fine. I tested it by POSTMAN and from postgresql I recieved JSON. But I need test it. I created test: when I run a test, I received error like below: What am I doing wrong? Answer The problem is this line: Right now you are sending the object in the
How to upgrade spring framework version in spring boot
I am using spring-boot 2.3.3.RELEASE with the according spring-boot-starter-parent in maven. Due to the spring4shell CVE I wanted to upgrade the spring-framework to 5.2.20.RELEASE instead of the already included 5.2.8.RELEASE. I tried overriding the spring-framework.version property from spring-boot-dependencies. But it did not work. I also looked up the spring-boot-starter-web-2.3.3.RELEASE.pom and it has the spring-web dependency hardcoded to 5.2.8.RELEASE. Are there
When developing the back-end, do you want to believe that the front-end data will not go out of scope, and reduce some data verification
In the scenario where the front-end and back-end are separated and developed, what the back-end does is to receive the data transmitted by the front-end, perform corresponding processing, and finally return the processing result information. So, for the data sent by the front end (whether it is Get or Post), do we want to be sure that it will not
java.lang.RuntimeException: not supported: class org.spockframework.gentyref.CaptureTypeImpl
Spock is being used to execute an integration test in a Spring Boot project (2.1.18.RELEASE). When I run with 1.3-groovy-2.5, I get this error: If I update Spock to a more recent version (eg. 2.1-groovy-2.5) I get this error: I am using Java 11 and Maven 3.6.3. My pom.xml is rather long, so I’ve reduced it to some snippets that
What “no code generation“ in Spring Boot means
Spring Boot doc states “Absolutely no code generation and no requirement for XML configuration.” What is “code generation” in that context? Answer It states that Spring Boot doesn’t generate or edit code Spring Boot does not generate code or make edits to your files. Instead, when you start your application, Spring Boot dynamically wires up beans and settings and applies
@ConditionalOnClass for `javax.validation.ConstraintViolationException` not working
I have a Spring Boot library that adds autoconfiguration. I am already using @ConditionalOnClass successfully to only activate parts of the library if Spring Security is on the classpath for example. Currently, my library requires spring-boot-starter-validation as a dependency, and I would like to make this optional. I added @ConditionalOnClass like this: But when running in an application, I get
Unable to fetch Parent data from Child
I’m trying to see whether a Cab is assigned to any Employee so I can fetch that Employee Id and simply to set cab as null, but @OneToMany mapping, simply returning a list of Employees & by this I’m not getting any method like a cab.getEmp() to fetch employee details Employee.java Cab.java Controller Answer In your code, Cab is perent
How to throw an exception if required properties have either null or empty values?
I want to throw an exception when I parse the received object to a DTO and while parsing if any of the fields in DTO that I have marked as required has null values then I want to throw an exception with 400 response. I have a controller like this, I have marked a few properties in my CustomDTO as