Skip to content
Advertisement

Tag: spring

Create custom finder with spring

I trying to implement a database with a many-to-many relationship.The database has been built, now we need queries to it. I’m using this article as an example: https://www.bezkoder.com/jpa-many-to-many/. When I create custom finder in Repository – server crushes at running. I have two Entity: MassageEntity and RstringsEntity. I’m trying to create a method List<MasageEntity> findMasageEntitiesByRstringsEntitiesId(Long string_id);. Without that method server

how do i save a new student that contains entities, but don’t create these entities because they already exist in the database?

I want to save a student and a student has a TargetAudience object as an attribute. These target audiences are allready hardcoded in my database. (targetaudience = campus + major). Now when i post like this: it doesnt work because everythime it creates a new object for the campus and because i use name as a primary key it throws

How to copy object that has a list with BeanUtils?

I’m working on a multi maven modules and I want to copy from entity to model with BeanUtils, here what I tried: This is my entity (with getters/setter/noargs/allargs): and this is my model (DTO Model): This is the output I’m getting: The problem is that the fields get copied but the list does not it shows me an empty List.

Using AOP and DI itself causes Spring ApplicationListener to be fired twice

Software versions Spring Version 5.3.18 and earlier JDK Version 1.8.0_202 Overview When I use Spring ApplicationListener, in order to prevent transaction invalidation, my ApplicationListener implementation class writes the following code (of course, the code can be written differently to avoid this problem), which will cause my listener to trigger twice after the event is published. I think it’s not normal,

How to add @RestController to spring-webflux apps?

The annotation @RestController cannot be resolved when only adding spring-boot-starter-webflux as maven dependency: pom.xml: What is missing here? According to many resources out there (eg https://medium.com/javarevisited/basic-introduction-to-spring-webflux-eb155f501b17), the webflux dependency should be sufficient for a webflux-webservice in spring-boot. Answer RestController annotation is part of org.springframework:spring-web: dependency org.springframework:spring-web dependency is part of org.springframework.boot:spring-boot-starter-webflux jar so it should get resolved. You can check

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

Advertisement