Above is my Super Human model. Please take note of the boolean variable named hero. Above is the controller method I am using to retrieve form data via servlet request. The commented portions are to be replaced with actual working code, once discovered. Above is the final piece. This is a excerpt from HTML fo…
Tag: spring
Spring is trying to subclass a record component when aop is present
I have a spring boot application in which I make use of aspects. Recently, I tried converting my @ConfigurationProperties classes to java records, but it fails with “Cannot subclass final class {..}Properties”. It seems spring is trying to make cglib proxies for my records, which obviously fail. I…
Testing @PreAuthorize annotation with hasAuthority()
I am trying to unit test my apis that have @PreAuthorize annotation. I am getting the cognito groups from the Jwt and using them as authorities. I check the same in the preauthorize annotation in the api methods. UPDATE: I get the 404 No mapping Delete profile/VOlUc3F5A_test.txt exists Test class: Controller …
Spring AOP and AspectJ on same method
I have a question about using aspectJ and spring aop method intercepting. I created 2 annotations: @AJTest and @SAOPTest. registered it and other and register it and added it to my method in controller Application class but when i call it by http://localhost:8080/test?firstParam=test&secondParam=2 i can&#…
auto changing data with Hibernate
I have problem with Hibernate. I have next method: This method should assign user on task and send message to kafka consumer with TaskBeforeUpdate and TaskAfterUpdate. But I have problem when I try to assign user, my BeforeUpdateTask change all his fields to TaskAfterUpdate. And this dont work, but i dont kno…
Pub/Sub Spring integration Queue Channel no poller defined
I have an application that connects to a pub/sub and processes messages when the pub/sub subscription publishes. I want to be able to put these messages into a Queue Channel to avoid processing loads of messages at once. However, when i try to add a queue channel i get the below error ? So the way i see it, a
Spring boot how to use @PostConstruct correctly
Spring boot 2.5.4 I used @PostConstruct for the very first time in my service class. As following:- This method is called as soon as app launched. That is my requirements to process all file as soon as the app starts. I have controller as following:- My app starts on port 8080 and no exception at all. But whe…
Spring data elasticsearch: Using @Document annotation on POJO interface class not working
I am migrating an application to the latest spring-boot version (using maven spring-boot-dependencies with version 2.5.4). I have an interface called Customer and I have two implementations of that interface (BusinessCustomer, PrivateCustomer) The three classes are annotated like that: For querying the index …
How to test Service method with ModelMapper call
I’m writing some Unit Tests for my Service class, specifically, an update method that does exactly that, update an Entity with the given data from a request. The problem is, I’m using ModelMapper to map the request data to the entity and when the test goes through the mapping statement it doesn…
Maven: Classpath dependencies and starters?
in this tutorial https://usha-dewasi.medium.com/service-registry-using-spring-cloud-netflix-eureka-cba573c693b under “Installing Eureka on Server Side” there is the instruction to Add org.springframework.boot:spring-cloud-starter-eureka-server on your classpath. Now as a beginner with maven and sp…