Questions tagged [spring]

Spring is a module based open source framework to build robust Java / Java EE applications.

Filter by
Sorted by
Tagged with
10 votes
1 answer
2k views

How to migrate existing legacy webapp to use OAuth2

I currently have a 15 year old legacy monolithic webapp with close to 1 million users, using a home-grown authorization & authentication system: JAAS, user names & pwds store in a DB with ...
  • 1,219
3 votes
1 answer
427 views

Workflow when using generated code

I'm working with Swagger to generate the API of my application. Swagger is an API specification language that can be used by a code generator to generate code stubs for your application. Obviously you ...
5 votes
3 answers
1k views

Does the use of frameworks make it unnecessary to learn design patterns?

I don't want to say that is not necessary knowing design patterns. I just want to tell you my experience. I've used Spring frameworks for four years and another frameworks (JSF, Mybatis, Hibernate, ...
1 vote
2 answers
2k views

How to implement notifications for expiring items?

I am working on a Java / Spring web application. The application issues licenses on demand. Each license has an expiry date. Licenses can be renewed by the admin. I want to send an email notification ...
0 votes
2 answers
290 views

How to I best test this method? Do I need to split it up?

Okay, please consider the following method. Let me first tell you that my goals of the method is to determine if file system assets exist. That's to say this is an internal company site where you'd ...
  • 139
2 votes
1 answer
338 views

Advantages and disadvantages of building web app purely with microservices and hybrid with web framework

Definition: Purely microservice: Not using any web framework such as Spring, Laravel, Zend, Django. Web app is a single page app loading data via Ajax calls to web services Hybrid: The web framework ...
  • 2,971
2 votes
2 answers
3k views

Should Microservice still use web framework such as Spring

My understanding of Microservice architect is that much of the work is shifted to the front end client side in a single page application (SPA). The SPA will then interact with the back end ...
  • 2,971
0 votes
1 answer
2k views

Decoupled architecture between business and data layers in Spring JPA / Hibernate

I'm using Spring Boot with JPA / Hibernate and I'm trying to decouple the business layer from the data layer. I would like to be able to (relatively easily) switch from a relational database to a rdf ...
0 votes
1 answer
1k views

Is this class thread-safe?

I have an entity class package org.demo.stack; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class ...
  • 399
2 votes
1 answer
3k views

Handling validation/exception responses in rest-ful app

So I am facing a problem with handling all sorts of exceptions within spring-boot application. Basically project is structured: back-end (services, repositories) <----- RestControllers <---- UI ...
  • 121
3 votes
2 answers
2k views

Architecture review - case study (Spring MVC)

I'm developing an Java Web Application with Spring, and I have some questions about my architecture. Before showing it, here is the context: I am developing a web application with more than 80 ...
  • 131
-2 votes
1 answer
172 views

How to develop UI using same server instance (without restarting)

I'm java developer. We developed good back end application. Customer asked UI part for it, but UI part development in our program needs each time restart the server (to refresh WEB static files). Is ...
  • 113
1 vote
2 answers
420 views

Unique Identifiers for classes - Java with Spring

My use case requires me to implement multiple validators which implement the interface: public interface Validator { boolean validate(Object o); } Based on the business group of the Object o, a ...
  • 19
2 votes
1 answer
703 views

Is Multi-Tenancy a viable option in any Java RAD Frameworks?

I've worked as a Full Stack Java Web Developer for many years now and of all the projects I have worked on two things are true of all of them: They were all Multi-Tenant applications with one ...
  • 157
6 votes
1 answer
788 views

Best practice for ensuring name uniqueness/correctness in message queues in a microservice architecture/distributed system

I was wondering what a good solution would be for ensuring that queue-names are entered correctly and are only used by the correct applications in a large system which uses message queues to exchange ...
  • 135
15 votes
2 answers
9k views

Microservice architecture shared domain models

Lets assume that we have a Spring Boot application that uses microservices architecture. Each of the services has its own domain models, but each service must reference a User domain object. What ...
1 vote
2 answers
269 views

Opportunity cost of DIY DI?

Java here. I have always used Spring DI (for Spring projects) or Guice (for non-Spring projects) for dependency injection, and have always loved them. I recently took a job where they do 100% "DIY DI"...
  • 4,750
2 votes
3 answers
3k views

Using spring to Avoid Singleton pattern

Considering that Spring framework can manage pretty everything related to object creation (life cycle, object scope ..), is it longer necessary to use singleton pattern in an application using the ...
-1 votes
2 answers
186 views

better way to load data for millions of users

I am working on a Spring/JSF app in which i have 1 scheduler to load user's sleep activity from fitbit. Right now what i do is that whenever the scheduler kicks in, I load ALL users from mongoDB and ...
  • 225
13 votes
2 answers
20k views

Structure of RESTful Service with Java Spring for Beginner

I am relatively new in terms of Java web development skills. I have a project that I think would make a good candidate for a RESTful service from what little I understand about APIs. I'm trying to get ...
  • 329
1 vote
1 answer
312 views

Software architecture for uploading dynamically created websites

I have a question that is crucial for my end of year project. Background My web application allows users to build other webapps based on drag&drop (within the domain of the webapp). These ...
  • 185
16 votes
1 answer
5k views

Why is it such a bad idea to share an interface between server and client?

I was reading the Spring Cloud Netflix documentation when I found out about a way to share an interface between an HTTP server and its client. They use this example for microservices, although there's ...
  • 263
5 votes
2 answers
576 views

Strategy to display value for a HTML select

Strategy to display value for a html select I have a spring boot, application. On the client side, I use JQuery I would like to know the strategy to display "static value" for a html select. ...
3 votes
1 answer
2k views

Best way to deliver and deploy JEE application to client

I've worked for a few companies and even developed projects on my own - these projects were based on Java Enterprise Edition. Sometimes with Spring Framework involved, sometimes it was a pure JEE. ...
5 votes
2 answers
2k views

Organizing maven modules and spring profiles

I'm facing a design problem with Spring's profile and Maven multimodule project from which i'm building a product, as a web as application that can be customized for differents clients. For this i ...
  • 3,456
22 votes
3 answers
8k views

API Gateway (REST) + Event-Driven Microservices

I have a bunch of microservices whose functionality I expose through a REST API according to the API Gateway pattern. As these microservices are Spring Boot applications, I am using Spring AMQP to ...
1 vote
1 answer
2k views

Spring - rest API - How to unit test a rest API which gets data from another service

I am new to rest API's as well as mocks. Please help me .. I have a set of rest API's for which I need to write unit tests. rest API in turn calls another service , gets the JSON response and sends ...
  • 11
6 votes
2 answers
6k views

Is it correct to use PUT with multipart content?

We are using Spring and want to implement a REST with a "override file" call so we think using PUT verb with a multipart body only to find that Spring don't accept it. My question is it can't be done ...
  • 313
2 votes
1 answer
1k views

REST is not appropriate for business applications because of necessary to distribute business logic accross layers. REST alternative required!

I have Spring+Java Server Faces (Facelets) application for which I would like to create Single Page Application (SPA) version, e.g. using AngularJS (which is the best and most popular GUI framework). ...
  • 1,001
5 votes
4 answers
14k views

Why is a Spring's HttpClientErrorException an unchecked exception?

Oracle summarises the purpose of unchecked exceptions as: The next question might be: "If it's so good to document a method's API, including the exceptions it can throw, why not specify runtime ...
  • 2,483
5 votes
1 answer
7k views

Logging RestTemplate's responses

I want to log responses using Spring's RestTemplate. At first I thought I should do it using a ClientHttpRequestInterceptor, but since every set of requests should be logged to a different file, I ...
  • 79
10 votes
2 answers
10k views

Client-side Rendering vs JSP's for Spring MVC Front End Dev

Firstly, a note on the app I'm about to discuss: It's quite large, on the order of magnitude of a service app like Airbnb -- i.e., it's not just a static web page, it is a full web application. It's ...
  • 111
7 votes
2 answers
6k views

How can I plugin new JARs implementing an interface dynamically?

Quick background: I am working on developing an interface that will be implemented by myself and other developers. This interface will allow users to "plugin" new functional code into a system for ...
  • 233
0 votes
2 answers
607 views

Spring-MVC : Testing code by automatically running it in UI

I am working on a Spring-MVC application(config XML based, no Main class) in which I would like to do testing. I have known that there is a way to test code which is backend+frontend code. For that, I ...
3 votes
1 answer
80 views

Getting instances without using the Spring context

I'm writing a small game of life implementation with Spring, but trying to avoid referencing the Spring context within my code. I have two interfaces, Board and Cell. In each implementation of Board ...
3 votes
1 answer
131 views

where to put methods that manipulate objects

I have a controller method as follow: public class RoomsController { @RequestMapping(method = RequestMethod.GET, path="/v1/rooms/{name}") public ResponseEntity<?> getRoomInformation(@...
  • 133
9 votes
2 answers
2k views

Synchronisation with offline system

I'm designing a system from which I will synchronise business data from the mobile device (that have an embedded application) that generates data and sends it back to the server. Each line ...
  • 3,456
3 votes
0 answers
62 views

Cache updates after not related REST request completes

I am wondering about the following scenario - it's in the land of Spring/AOP and Ehcache. Happens in REST Web Application - REST/Service/DAO layers - I have objects in cache (@Repository + @Cacheable)....
0 votes
1 answer
893 views

Conditionally creating objects at runtime using Spring.NET

I have a couple classes in a project I'm working on that only register event handlers. public class EventLogger { public EventLogger(EventRaiser someObject) { someObject.EventRaised ...
3 votes
0 answers
837 views

Securing a REST API based on authentication with external site

I have a website with an already-established authentication system. Once a user logs on to it, one of the features is a statistics application based on AngularJS. The app communicates with an ...
  • 31
2 votes
1 answer
331 views

Using Spring in Java Project

I've got a question about a correct usage of Spring. I know that some people use the DI "aggressively" so that they always use spring and completely eliminate the usage of word "new" in the ...
9 votes
2 answers
695 views

Gradually move codebase to dependency injection container

I have a large codebase with a lot of "anti-pattern" singletons, utility classes with static methods and classes creating their own dependencies using new keyword. It makes a code very difficult to ...
  • 217
0 votes
1 answer
5k views

Spring Consuming Internal REST WS for MVC

Sorry in advance if this is a little confusing, it's difficult how to phrase this. I am currently using Spring MVC with some RESTful services mixed in for some AJAX client side logic. I am looking ...
  • 233
3 votes
0 answers
38 views

Approach for querying an arbitrary set of user submitted fields and values in Spring application? Like a shopping site sidebar search?

I am working on a Spring Boot and Angular application which has a requirement to search based on any number of the available filters being applied to a list. For example, a user searches on 'Title' ...
  • 191
30 votes
6 answers
33k views

In which layer should validation be located?

I'm creating a Rest API using Spring Boot and I am using Hibernate Validation to validate request inputs. But I also need other kinds of validation, for example when update data needs to checked, if ...
  • 401
3 votes
1 answer
2k views

Using prototype/non-Spring managed beans in Spring Web application

I have been working on few web applications/REST web services recently (Spring IoC/MVC/Data JPA etc) and they usually follow the same pattern: Controller classes --> Service classes (which have number ...
  • 133
3 votes
0 answers
141 views

Camel/EIP/ESB with messaging from a website to process an order; synchronous and asynchronous

I am investigating Camel for connecting various services. I understand the core concepts but I was curious about more specific implementation details. This application would have a browser client ...
2 votes
2 answers
3k views

Testing using mocking, must I mock all dependencies too?

I have the following method to test: public List<MarkId> getMarkIdList(ICar carDoc) { ICourseCar courseCarDoc = courseCarRep.get(carDoc); List<MarkWag> markWagList = ...
7 votes
1 answer
2k views

Spring Batch + Web Scraping

I need to develop a batch processing that will be executed every day. These are the steps: Read each line of a database table that contains a URL (SQLite) Extract some data, say Users, from that ...
  • 717
53 votes
4 answers
17k views

Why do we need frameworks for dependency injection? [closed]

I've been reading up more on the Inversion of Control principle and Dependency Injection as an implementation of it and am pretty sure I understand it. It seems to be basically saying 'don't declare ...
  • 641