Skip to content
Advertisement

Tag: spring-boot

user detail service cannot be cast to user in a unnamed module loader app

I don’t know what I did wrong. I was trying to implement the Jwt token(only post method).it shows the exception that Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.ClassCastException: class com.vivek.discussion.service.UserDetailServiceImpl$1 cannot be cast to class com.vivek.discussion.model.User (com.vivek.discussion.service.UserDetailServiceImpl$1 and com.vivek.discussion.model.User are in unnamed module of loader ‘app’)] with root cause

Factory design patter Spring Boot double bean

Calling method executeSPV from abstract class If I remove @Componet from Upload and Download classes I receive error I need to add Bean for abstrcat class CommndBase If I use @Compoment on Upload and Download classes I receive dual Bean is useed… Field command in .Controller required a single bean, but 2 were found: Answer You should not use @Component

Non-resolvable parent POM for xxx

I’m trying to package a maven project and the IDEA console says “Non-resolvable parent POM for xxx”. The parent pom has been put in my maven local repository but can not be resolved by the submodules. The submodule’s pom.xml reports errors like this. The parent pom.xml looks like this The project seems like downloading the parent pom from the central

hibernate validator throws exception ValidationException: HV000028 for @Past annotation

I am validating an entity with a hibernate validator in a spring boot project. I got an exception for the Date validator @Past . I faced javax.validation.ValidationException: HV000028: Unexpected exception during isValid call This is the dependency I have in my gradle.build file implementation ‘org.springframework.boot:spring-boot-starter-validation’ The following my a similar entity I have This is a log trace Answer This

FilterRegistrationBean url pattern doesn’t work

I am registering a filter as shown below For log output i want url pattern : /*/api/* Answer Since the code registers a Servlet Filter, the URL pattern must conform to the URL mappings supported by Servlets/Filters, as specified in the Servlet Specification: 12.2 Specification of Mappings In the Web application deployment descriptor, the following syntax is used to define

Springboot – validate @RequestBody

Question: It is possible to validate the JSON payload of a request body, without specifically writing if statements? Maybe via annotation or configuration? I have a very easy POJO: And a very easy controller class: If I query with a payload such as: Everything is working perfectly fine, very happy. However, if there is a typo: (note the typo on

Spring Boot – Jackson EntityNotFoundException returns 200 instead of 500 response

Exception handler is returning 200 response even though I have specified it to return 500 in the handler (HttpStatus.INTERNAL_SERVER_ERROR) when encountering this exception. I am using Spring Boot v1.5.4.RELEASE. I am calling a Spring Boot service returning a JSON object. I am using a custom exception handler. When an EntityNotFoundException occurs during deserialization, instead of returning 500 response, it returns

Advertisement