Skip to content

Tag: spring

return throw exception in Kotlin

I have the following problem, I can’t return this exception. It’s giving an error 500 and doesn’t run this exception. I wish that when I entered the if it would already return this custom exception. KOTLIN JAVA Answer You need to use RestControllerAdvice or ControllerAdvice like

Failed to determine a suitable driver class spring

When I run my Spring Boot project, I get this error: Description: Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a suitable driver class Action: Consider the following: If you want an embedded database …

Property file reading error in spring boot

Below is my yml file in spring boot app below value access is working file but when I try to access in below way it gives an error. I checked it gives error only when add “com.cloudimpl.outstack.runtime.EventRepositoryFactory” this part. How can I solve this?? Answer It doesn’t work so. You …

Underscore in model class on Spring Boot

I doing the maintenance of this code please can someone explain what is that notation Post_ in the code below? I know Post is a model that I created, but Post_ with underscore is not in files. I searched but didnt find any information about this. Its a pre generated Spring Boot file? And if so how to create i…

How do I compare Integer and Long types with Junit?

How do I compare Integer and Long types with Junit ? The result of assertThat(poiList.get(0).get(“id_pk”)).isEqualTo(member.getId_pk()); is: The two types are: How can I compare 1 and 1L to be equal? best regards Answer You can convert Integer to Long via java.lang.Integer#longValue: BUT beware of…

Spring Boot Patient Application

an image of code for some reason I am trying to have a little API run. Everything runs fine but I have to make an addition and am confused. I have to have it so in the URL when I type “localhost:8080/api/v1/{illness}” it will display the names of the people with that illness…help. I have inc…

Spring security application giving No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken

I am new to spring boot. I am trying to implement a simple spring boot security with userdetailsservice in Spring Tool Suite(STS). Below is the controller I used: And the Web security configuration code: I gave all the required dependencies in pom.xml. So, I have added below line in application.propperties fi…