Skip to content
Advertisement

Tag: spring

Mongo aggregate sum of two Strings

I am trying to sum one field in Mongo. If it is an Integer there is no issue, but the problem is that it is String and I get 0 for totalAmount amountField is a String, how can I sum it in this implementation Answer You are getting String amountField. Simply you can convert this String to Integer by using

Spring SFTP : Unable to rename .writing file

I am using Spring SFTP integration to transfer the file and many time I got this error. It seems two threads are trying to transfer same file and conflict with each other 2020-08-03 08:31:55,766 INF [task-scheduler-8 ] o.s.i.ftp.session.FtpSession – File has been successfully transferred from: ./abc.ext.200803 2020-08-03 08:31:55,849 INF [task-scheduler-7 ] o.s.i.ftp.session.FtpSession – File has been successfully transferred from: ./abc.ext.200803

Is correct to have private method in service layer? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question I am developing a service using Java and Spring Framework, I have business logic at the service layer, but I

Spring 5.x and CDI 2.x Integration Options

Considering Spring’s 5.x baseline and CDI’s baseline 2.x, what more viable options should I consider to integrate them into a project with JSF 2.3, since JSF 2.3 is coupled with the CDI? Bridges? Custom Bean Factories? Others? Answer We use bean producers to access Spring objects in CDI. As in the architecture we used there is an interface layer between

WebClient – adding defaultHeaders

I’m trying to put multiple headers into defaultHeaders(), But I don’t have idea how to create Consumer object from return of createHeaders() method I can build my header in that way: but how to wrap it into Consumer? Answer Clearly the method doc says that it needs a Consumer of some Type. So you can create an anonymous class implementing

Why is @Validated required for validating Spring controller request parameters?

With the following validation setup in an annotated MVC controller: @Validated on the controller is required for the method parameter since it’s not a “complex” object. In comparison, the @Valid annotation on the setOther method works without the @Validated annotation. Why is @Validated required? Why not enable it by default? Is there a cost to its use? edit Note that

How to properly filter Spring REST data

I have a Spring Data REST service with a single @Entity and Repository. When I run $ curl localhost:8080/api I get all the data stored in my repository and it works as expected. I also have a small React front end and I display that data there. My question is: Where should I filter the data? For example maybe I

Advertisement