I am moving some test code from an older jHipster project to a new one. The old project uses the org.springframework.cloud.netflix.zuul library, specifically org.springframework.cloud:spring-cloud-netflix-core:1.3.0.RELEASE . I put the below in my new project’s pom.xml: However, it seems to be pulling i…
Tag: spring-boot
HTTP Status 404 – Not Found: for controller – no view resolvers found in Idea
I have the following Spring MVC code: config files: contollers: I get the following errors when I deploy: Accessing the /api page, however, works just fine. EDIT: After replacing home.html with home, the error is still present – both in IDE and the 404 in browser: Also maybe it’s relevant – …
SpringBoot – Java AWS SDK 2 DynamoDB Enhanced Client and devtools problem
I am using Spring Boot 2.17 and java sdk and dynamodb-enhanced ‘2.13.8’. I am calling with the enhanced client an item like this: it leads when called to this error: Switching the livereload to enabled: false did not help but completly removing the devtools worked. But this a not statisfying solut…
Using static methods with Spring Security to get current user details
I have a requirement to get the details of the current user who has been loggedIn. To get the details, we can use the SecurityContextHolder.getContext() and extract the details. According to, SecurityContextHolder, SecurityContext and Authentication Objects By default, the SecurityContextHolder uses a ThreadL…
Error when running docker container “NoClassDefFoundError”
I am trying to dockerize a simple Spring Boot Application, built with Maven. Dockerfile: When I run the .jar without the container (java -jar target/backend-1.0-SNAPSHOT.jar), everything works fine and the app is running. Now I create the container with docker build -t company/backend . But when I try to run …
How to mock JWT authentication in a Spring Boot Unit Test?
I have added JWT Authentication using Auth0 to my Spring Boot REST API following this example. Now, as expected, my previously working Controller unit tests give a response code of401 Unauthorized rather than 200 OK as I am not passing any JWT in the tests. How can I mock the JWT/Authentication part of my RES…
Regex query in spring boot mongoDB on integer
My data schema in mongoDB { } I want to query on itemId such that if (In my database itemId is (1,2,12 , 13 , 15 27) ) if i search for itemId 1 then it fetch data start from 1 mean fetch data of itemId(1,12,13,15) if i am not pass itemId then fetch whole data. Please help me thanks
Calculate the percentage of value using Collection framework
I have List of TrainingRequest where each and every element has List of Feedback. I need to get all given result of Q1,Q2 and calculate percentage of each value. To flat all the feedback To calculate each value of Q1 and Q2, I’m grouping it and getting the count. I need to get the percentage of each Q1,…
Spring Data @Query use VARCHAR instead of NVARCHAR
The code that I posted is not the code that our companies uses, it is just example code to correctly illustrate the problem. I have the following Spring Data Query: For entity Customer: and Name: This works okay, but Spring data passes these parameters as NVARCHAR instead of VARCHAR. Therefore, the DB has to …
Spring boot HATEOAS integration issue
I have included hateoas dependency in my spring boot project but I am unable to run the project because of few exceptions that are being shown. I have tried cleaning the workspace, mvn clean install and also restarting the application but it’s not working. Is there something I am missing here? pom.xml E…