Skip to content
Advertisement

Tag: spring

How to handle UsernameNotFoundException spring security

How to handle UsernameNotFoundException ? In spring security when username not found the UserDetailsService implementation throws a UsernameNotFoundException. For example like this: I would like to build a custom “User not found REST response”. How should I catch/handle this exception? I have implemented a handler method in the WebSecurityConfigurerAdapter implementation the handler: But this method should wait for an AuthenticationException

Sonar “Make transient or serializable” error

I have the following serializable class (implements serializable): However , it seems like this property is causing some problems with serialization : How can I solve this problem ? Also , is there any downside in not making this transient or serializable ? Will I be able to serialize this class fully ? Answer The Map interface does not extend

How to use Criteria in JPA in Spring boot?

I am using JPA and spring boot. I am new to JPA. I want to retrieve an object by passing the value of the function. But in example, it is done through hibernate config. I have not config sessionFactory bean in my classpath. I want to use JPA to retrieve the object. Here in the example, it is: But I

How to remove data source warnings in Spring Jpa and Intellij Idea?

After new update Intellij, I have red warnings in entity classes. For example: I have warning lines under “poll_answers” and “poll_id” “cannot resolve table/column” and offers me press “assign data source”. Answer Your setup: Spring, JPA, ORM Since your Spring project uses JPA and you are defining object-relational-mappings (ORM) using annotations: IntelliJ is intelligent and tries to validate the specified

Spring WebFlux and WebSocket

I am trying to add WebSocket functionality to an existing application which uses Spring WebFlux. It uses: Spring boot 2.2.1.RELEASE Tomcat container Configured to serve jsp pages When I try to connect to it through JavaScript (from inside a jsp page) I am receiving the error “failed: Error during WebSocket handshake: Unexpected response code: 404” I noted that if I

Advertisement