I am using Spring MVC controller. Is it possible to set an object in the path value in a radio button ? below my form inside my jsp And my controller Here is my AddressForm I want to retrieve the selected object address from my controller but I have an Error bindingResult.hasErrors() return true with the following error and form
Tag: spring
How to implement a synchronous job queue in Spring?
I’m trying to find out how to implement a job queue using Spring. I’ve got a server up and running that I plan to have users submit POST requests to. This will take in some data and will then queue jobs to process this data. The processing of this data is an expensive process that can sometimes take 5 to
How to use explicit links with Thymeleaf?
I wanted to make and link to external site in Spring+Thymeleaf web application and inserted link like this: <a th:href=”@{https://example.com}”>Link</a> However by clicking the link it tries to point internal location http://localhost/service/https://example.com not external website https://example.com like it supposed to. Site gives just an error “status”:500,”error”:”Internal Server Error”,”message”:”The request was rejected because the URL was not normalized.” What’s wrong and
Spring Mockito @BeforeAll mocking logic works on 1 test only
I have a problem with understanding why the logic mocked inside @BeforeAll works, but only for the first test. They work fine separately, copying the identical logic to both tests will produce the same result – 1 passed, 1 failed. What happens: in AboutUsService.update() on the first line appears the mistake at pageRepository.getByName(ABOUT_US_PAGE).orElseThrow(null); For the first test, the calling of
How do I work out the entity relationships in my game collection database?
I have a game collection application where I want to create seperate lists of games. I am using Spring JPA and Hibernate in the backend and this is what the Entity classes look like right now. I am not sure if this is even the right approach… In the end, I want to create a Spring Boot application where users
Compression is not working in spring but, it is showing Content-Encoding as gzip in the response headers
I am trying to compress the response from a java spring-boot application. I referred to some tutorials and StackOverflow questions and found that I just have to add these lines in the application.properties file, so I went ahead and added those, but after adding these lines, I am getting the Content-Encoding as gzip but the size of the response is
Sort collection according to user custom input by single or multiple attributes
I have collection of Item object and the class Item is as follows -> Now, I want to sort according to the user input. User can sort it according to his choice like brand, price or publishedDate and even with the multiple parameters. Like brand and price or price and publishedDate. I have seen Comparator to sort by multiple parameters
Spring Boot Batch – Stop and Start a multithreaded step with CompositeItemWriter
I am trying to stop and start a multithreaded step through Scheduler. But I am getting exception as If I understand correctly we wont be able to restart an multithreaded step. But I am not restarting. I stop the job by stepExecution.setTerminateOnly() through ChunkListener() and trying to start this by jobLauncher.run() in a scheduler. Here is my codes; StopListener.java This
Spring pageable sort on other entity’s nullable attribute
I came across the following problem… I have three entities: and method using Specification for fetching information about Contracts: and now, my application gives the possibility to sort Contract entities by Department name, so there comes Pageable object with sort parameter set to employee.department.name. And the problem arises when Employee object has department parameter set to null… E.g., if all
Query on parent’s collection – Hibernate Specification
I have three tables created with Hibernate. Product is the parent while barcodes is a collection end price is a child (one to many) of products. I’m trying to query starting from the child (Price). I was able to query on a string but now i would like to query on the collection s element. how would you write the