Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [spring]

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise ...

0
votes
2answers
35 views

Printing the status of a database insertion as JSON

The controller is currently inserting a record into the database and returning a JSON response as shown below in the try-catch block. I can see the ...
1
vote
1answer
35 views

Testing a service that makes database calls, without a database

I'm working on a new service, for the past year I haven't needed to write tests from scratch. I've either been bug fixing, or adding features that require modification of tests, but not writing ...
0
votes
0answers
26 views

Java Controller and Service - Implement Getter and Setter in Service [closed]

I have the following code : UserController.java : ...
1
vote
0answers
16 views

Handling slow processing the Spring batch way

We are using spring-batch to extract data from a SAP system, during processing we pass the extracted full texts to a tagging service, in the end the enriched documents are stored in Solr to be served ...
0
votes
1answer
37 views

Refactor REST service with overcomplicated logic

Need to perform such actions: receive JSON from REST extract nexted JSON document calculate hash of the nested document add some fields to extracted document and save it in database return response ...
1
vote
1answer
28 views

Simple JDBC Query By Example (QBE) for Spring JDBC Template

This is a quick and dirty QBE method that covers about 60% of my use cases in my DAO. I just wanted to see if someone would take a quick look at it to see if there are any issues. ...
1
vote
0answers
40 views

Java Multipart text file analysis to zip

So I am working on a project that should take .txt file as an input and analyze words in it (assuming all words are English). Program must run asynchronously. Final output should be multiple .txt ...
1
vote
0answers
29 views

Business logic validation as custom Bean Validation annotations?

This is not my solution but that of an existing application I am enhancing. Basically what they are doing is annotating a Form.java with a custom validator that ...
1
vote
1answer
48 views

Spring API that performs RSA encryption with exception handling [closed]

I'm creating a rest api using Spring which utilize javax.crypto as library to do some encryption stuff. While everything works well, I'm curious whether the error handling like this is acceptable or ...
0
votes
0answers
19 views

Untangling a data class where annotations from different frameworks mix

The framework mix problem I'm using two frameworks -- PingIdentity's SCIM 2 SDK, which uses Jackson, and Spring LDAP -- to deserialise a SCIM resource (i.e. JSON) to a Java object then write it to an ...
0
votes
0answers
29 views

Update external properties at run time in java 8

I already achieved how to update external properties at run time but I think it can be improved and I'm not sure about possible errors than I can be missing. First I'm setting to the vm the external ...
2
votes
1answer
88 views

Dropbox Java Spring Boot connector

I've created a service that connects to Dropbox and makes it possible to download and upload files, create and list folders and remove file or folder. Full code is available on GitHub: https://github....
2
votes
1answer
36 views

More elegant way to construct the S3 path name with given options

I have a method that generates the S3 key prefix according to the provided args. However, my gut feeling is that this method is not as elegant as it should be, maybe I just don't have an eye for it. ...
3
votes
1answer
104 views

Spring Boot Websocket STOMP Crud

I have a personal project that runs the backend under spring boot that implements websocket for real-time functionality and I apply it to a crud operations. Although the code is working and work as ...
0
votes
1answer
37 views

Convert automatically into a centralized bean for multiple domain objects

I am creating a project which will respond to collect multiple bean object, save it to the database and return the status of the transaction. There can be multiple objects that can be sent from the ...
0
votes
3answers
70 views

Spring Boot DAO

I am using spring boot with NamedParameter JDBC. Please suggest any improvements to my code. This DAO first determines which datasource to connect to which is based off the condition of the request ...
2
votes
1answer
61 views

Create annotation to validate JWT in Spring controller instead of filter

I developed a Spring RESTful service that uses a JWT for authorization. To the validity of this JWT, i used two different implementations. Create a filter to intercept every request and validate ...
0
votes
1answer
233 views

Toy Robot coding puzzle with Java

The following code is my solution to a code challenge I submitted a few days ago. I got rejected straight away with no feedback and I've wondered why. Here is the full code repo. Requirements ...
2
votes
0answers
138 views

Create HttpClient using PoolingHttpClientConnectionManager

I have a java service class which will call a REST service and get response back. It is working fine in developer environment where less requests are made, but I still wanted to get a review. My ...
1
vote
0answers
39 views

Wrap Business Object to DTO with additional fields [closed]

My REST service has 3 layers: Persistence Layer - database entities live here Business Logic Layer - business objects live here Access Layer - data transfer objects live here The flow for reading a ...
2
votes
1answer
65 views

Inject a list of processes to execute using spring DI

I have couple of MessageProcessors. One of the Processor will log the payload. Other ...
1
vote
1answer
67 views

Kotlin API - endpoint for users

I am writing API in Kotlin - this is my first code in this language. I implemented a very primitive 'player' endpoint. I was wondering if I am doing everything ok (please don't mind the static ...
1
vote
1answer
72 views

Copying notes takes a very long time

I am working on a Spring-MVC application in which we have note like functionality. Notes can have attachments, history, etc. There is a method to copy notes. When a note has a large number of ...
2
votes
1answer
43 views

Obtaining information about the logged in user

I currently have a special service to obtain information about the logged in user. I have an interface ...
2
votes
0answers
68 views

Unit/Integration Tests for Maven plugin that creates Skipper packages

I am writing an extension to a maven mojo (spring-cloud-skipper-maven-plugin) and I am now writing tests that interact with a skipper server. However, getting the ...
0
votes
0answers
28 views

Handling entities and data with repositories in service layer

In general this backstory does not matter but just to explain the code: The server handles users and user groups. User groups are able to "discover" places - at this point in time these places are ...
4
votes
1answer
139 views

User registration - Controller, service and repository layers in Spring framework

I'm writting a registration feature currently and I I'm confused how to divide logic between layers. Can you review this code and tell if it's good way to do? In try-catch block I publish event to ...
0
votes
1answer
62 views

Spring: Creating a Mutable Common Command Object or Controller Interceptor

I'm integrating with a 3rd party vendor that has Users and Organizations in it. My tool is a user administration tool that ...
3
votes
0answers
94 views

Bloom filter algorithm usage in spring boot rest service

I have implemented spring boot rest service which has only one function - get status of invoices by unique ID. In the scope of this task I have implemented Bloom filter algorithm to avoid unnecessary ...
2
votes
0answers
60 views

Initiate, propagate, validate, send, and marshal a message in Spring

Purpose of code The goal of this code is to: Initiate a message propagation to other systems Validate that the given message adheres to its XSD schema, and then marshall it Send it on a Camel route ...
1
vote
0answers
625 views

Spring Boot + Spring Batch - feedback

I am newbie to Spring Framework. I am trying to move table data from one vendor database to another vendor database using Spring Boot + Spring Batch. I am looking for feedback if this correct approach ...
1
vote
0answers
2k views

Pagination using Spring MVC and Hibernate

My company develops a Spring web application that exposes a REST API and right now we're starting to look into pagination for the methods that load data from some heavy tables. We initially looked ...
0
votes
1answer
1k views

Map DTOs and Models within the Service Layer due to a missing Business Layer

The following is the story of a UserCredentialsDto that arrived at one of my endpoints and how it finds its way through all the layers namely REST Layer Service ...
2
votes
0answers
415 views

Implementation of reactive file write from InputStream

I want to implement reactive write to file. In low level, it uses NIO and Futures. After reading this section I created this code but maybe there's more clean or less code solution. Thanks. ...
0
votes
1answer
502 views

REST API design using spring boot

The following API caters to CRUD operations on users and their corresponding filters (kind of rules). These filters are applied on incoming data from various sources basing on user and then a variety ...
1
vote
0answers
24 views

Retrieving the count of users with complete and incomplete profiles

Problem I have to display the count of total users with Incomplete and Complete Profiles. Incomplete Profiles are those which will have 4 fields of String type. ...
2
votes
1answer
48 views

Generating Report Data in CSV format for various cases

I have to show report data for various cases in text-csv format as soon as the user click's on the given URI's. The given cases are: End_Customer Data Incomplete Profiles. Total Connections Below ...
3
votes
1answer
1k views

Custom ResponseModel for Spring Controller - ResponseEntity<?>

I created a custom responseModel to have a standard json responseModel for some of my different RestController. Superclass TransactionResponseModel: ...
1
vote
0answers
47 views

Approach for validation in domain layer

I was struggling for some time with proper implementation of domain validation in the context of domain entity and it's properties. By the time validation comes down to check if property value matches ...
1
vote
1answer
830 views

SpringData: filtering fields of Entity in Repository

My entity is Office. In office repository I would like to find all office Addresses: ...
0
votes
1answer
83 views

Refactoring service class which communicates with external API

Below is the class definition which I created as a POC for some project, at present the class does too much thing and I don't know how to what would be a good design i.e. which object to use as DI etc....
2
votes
1answer
54 views

Java orchestration calls from two CRUD endpoints

Here is my orchestration endpoint where I call customer endpoint and product endpoint. Product endpoint contains info about what customer have what product. I do not like how it look and smells as ...
1
vote
0answers
47 views

Configuration for Embedded Broker ActiveMQ

This is my configuration for sending messages to an embedded broker. Also, the first bean method is used to just create and start the broker. It doesn't return any instance. Please a take a look at ...
3
votes
1answer
87 views

Using Maven Profiles to divide functionality

We have a Spring Boot parser application, that supports a bunch of formats. We need to divide this Parser application into several types. Each such type is simply defined by the set of formats ...
2
votes
2answers
6k views

Transaction in spring boot

I am using spring boot in my application. ...
-1
votes
1answer
493 views

How to avoid duplicate code due to the impossibility of using multiple inheritance

I'm working on a Spring - Hibernate App, and I have a question about how to correctly avoid duplicate code and using Hibernate, due to the impossibility of using use multiple inheritance (I usually ...
4
votes
2answers
350 views

Google Maps API with Jackson Parser

I am working on the Google Maps API, doing a reverse geocoding with the following code snippet. What I am using are: Spring Jackson Parser Google Maps API It is working fine but it gives results a ...
8
votes
1answer
2k views

Spring JWT authentication using cookies

I'm working on a experimental code which allows users to authorize using JWT's jjwt library. Here's what I have done so far on authentication and authorization flow....
2
votes
0answers
60 views

Generate a patch description from multiple SVN commits

I have a Spring app that is used to create patches for another application. My client retrieves a list of branches from a SVN repo through the initial AJAX call, then if one branch is chosen, another ...
1
vote
1answer
92 views

Class Design : Parsers for different file type and ParserFactory

I have come up with a class design for parsers (for xml,csv etc) and parser factory. I will be using it in my project.I will be configuring these as beans in the spring context file. I would like to ...