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 ...
5
votes
0answers
29 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
16 views
Error when inserting data into a database using Spring and Oracle [closed]
I am a coding newbie, I have been learning spring and I get this error every time. I have tried googling and checking Spring and Java forums, but, I have been unable to find a solution that fits. This ...
1
vote
0answers
18 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 ...
0
votes
1answer
49 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 ...
2
votes
1answer
286 views
SMS sending through Clickatell
I have to implement a method in which i'm passing two arguments as Mobile number and second one is Message to be sent.
I'm using clickatell for the first time and its successfully sending the ...
0
votes
1answer
52 views
Service Layer in Spring Data
I'm building a small application in Spring and Spring Data JPA.
I need serval layer. I don't know if I'm doing well.
Here is an example:
POJO
...
3
votes
0answers
35 views
Initialising numerical properties from a text-based properties file
This is a Spring Framework-based datasource instantiator which reads its properties from the Spring Framework context, i.e. the values are initially all String from ...
0
votes
1answer
44 views
Implementation of getUsersWithStatuses based on getUsersWithStatus
In my code I have method which gets users from database with concrete status. And now I have to add new method which gets users from database with list of statuses. I don't know, is it better to ...
2
votes
1answer
210 views
Is my implementation of a simple CRUD service with Spring WebFlux correct?
I am implementing a simple Movie based CRUD API using Spring WebFlux and Reactive Spring Data MongoDB. I want to make sure that my implementation is correct and that I am properly using Flux and Mono ...
3
votes
2answers
118 views
Spring Boot RESTful service
I have developed this restful service using spring boot. Please look at the code if there is something to change to be more consistently.
Resource
...
1
vote
0answers
52 views
Spring Data Redis - mapping object relationships?
I'm designing an app that will process a set of social media messages which are posted by users. Each message is then scored and there is a reporting layer that will spit out a set of reports. The app ...
3
votes
1answer
125 views
Authentication via LDAP and authorisation via JDBC
I have a custom AuthenticationProvider for getting authentication via LDAP and authorisation via JDBC. It's running but I think it's not the best way.
My custom ...
3
votes
1answer
102 views
REST API that allows creating/removing users, CRUD ToDo tasks
My project is supposed to be used as back-end for a simple to-do web app that lets you create an account, add, edit, complete, and delete todos.
It could be used with some front end consumer like ...
2
votes
2answers
92 views
Object to return user specified generic types in backend code
The idea is that a user will dynamically edit simple key/value settings that will customize their instance of the application, e.g. the welcome banner text. I am trying to implement everything in a ...
0
votes
0answers
87 views
Optimizing Java (controller and service) code to work faster
I am creating online store, using spring MVC. So the point is when you create new product you need to upload picture for new product. I am using Cloudinary service, so when you upload image server ...
0
votes
0answers
22 views
Move nodes if no veto from councilors
Working on a DTP based on Maven/Spring having a JTree(containing nodes as layers) try to implement a Authorithy for decide if layers can be droped to a target-layer....
3
votes
1answer
102 views
Bot-like Spring Java service for checking advertisements
I am in the middle of developing a Spring Boot application, which has a service acting like a bot.
advertisementService.update(Advertisement ad) is a method which ...
1
vote
1answer
710 views
Spring AOP Log4j Logger example, improvement
I went through some of the stuffs on net regarding spring AOP and wrote a Spring AOP logger.
Can you guys check my code and give your valuable inputs to improve it or if it is not proper, give me an ...
1
vote
0answers
85 views
Spring MVC web app for simple ciphers
I'm working on a simple Spring MVC web app that allows users to encrypt and decrypt messages with classical ciphers such as the shift or Caesar cipher. It also allows users to auto-decrypt a message ...
0
votes
1answer
120 views
Does this unit test cover all edge cases? [closed]
I want to test a simple controller and I want to know if this unit test covers all cases:
Controller:
...
2
votes
1answer
582 views
Reading SQL file using injection and utility reader
I've come up with a way to externalize and read in my .sql files instead of having them in-code as strings. Note that I'm keeping the .sql file in the same package as the DAO (NOT separated into a ...
0
votes
0answers
38 views
Factory for ListenableFutureCallbak
I'm developing a Rest API, and at the moment i have a bunch of controllers like this one:
...
1
vote
0answers
150 views
Spring controller for login using Facebook or email
I've got a spring controller class which handles the user logins.
I've got two endpoints:
/user/facebook
/user/email
You can ...
3
votes
1answer
124 views
Extending functionality of org.springframework.batch.item.file.transform.DefaultFieldSet
I would like to be able to set token values (defaultFieldSet.tokens) and names (defaultFieldSet.names) on ...
1
vote
0answers
31 views
2
votes
1answer
124 views
Refactor legacy code to spring
I am refactoring a legacy codebase to use spring. I am newish to spring and was wondering if you have any suggestions for the following code I refactored. Specifically about providing the ...
-1
votes
1answer
79 views
Accepting any object and returning the object
I have been tinkering with generic methods in Java but still haven't figured out a way to optimize this code. Here I need to write similar piece of code for both plan and add-on.
...
4
votes
1answer
98 views
Code for my first crud app
I would like to ask more experienced developers to review my code, it's my first app, self-made, I know there is a lot to improve, it would be great if you could just point the main errors.
I'm ...
1
vote
0answers
52 views
Updating many fields based on data from a web service
I have to receive data from a webservice and need to compare the received data with the data in our DB.
Its easy like: get a streetname from the WS, if its not null and not equals the Db entry -> ...
1
vote
2answers
410 views
Write into the same CSV file multiple times
I implemented an OutputWriterService.class to write content in the same file multiple times.
The writeToCsvFile method is ...
2
votes
0answers
142 views
Pagination links for various lists using Spring-HATEOAS
I'm using Spring HATEOAS to create some links on my REST API. However, the entities i'm returning are very close, so the code to generate the links are the same:
...
2
votes
1answer
137 views
An asynchronous service to produce a results cache for a list of items
What I've created is a CacheBuilder service that will be passed in a list of items, and will build a results cache. The results are produced by making calls to ...
-1
votes
1answer
59 views
Spring Web MVC where to put logic [closed]
I am trying to create an application where I need to know where to put the logic. Here is the code
HomeController.java
...
0
votes
1answer
928 views
breadcrumbs in spring
Breadcrumbs should look like this:
Home > Mobiles & Tablets > Mobile Phones > Phone Super Duper
every product belongs only to one category. e.g Phone Super Duper can be found only under Mobile ...
0
votes
1answer
468 views
Detect that a class is marked by a custom annotation in Spring
I would like to enable application behaviour based on the presence of a custom annotation that marks the configuration class (normally named something like ...
1
vote
0answers
231 views
AspectJ aspect for securing controller methods with ReCaptcha
Today when I was implementing ReCaptcha (as if there is much to implement!), I thought it would be perfect to create an Aspect Annotation to automatically secure web methods with recaptcha.
My ...
1
vote
1answer
42 views
Seperate out validations from a service and use custom exceptions for entities not found
I am using spring-boot, spring data, and Java 6. Here is an example from a business layer to save student details.
Srvice interface:
...
3
votes
1answer
282 views
Implementation of observer pattern in web app to monitor an RSS feed
I implemented observer pattern and it will be great if someone can do review of my work and say what should be done better.
What is the problem. Application monitoring rss channel, if there is ...
4
votes
0answers
488 views
Implement two level caching using spring's cache abstraction Cache and CacheManager
Details about spring's caching framework are here. When I was reading this link, I thought the composite cache mentioned there was one that used levels of caching based on the order given to the ...
3
votes
0answers
66 views
Implementing a long-running entity lock
Requirement
I have an entity named ImportData which can be processed once in order to extract data from a file fed to the application.
I need to make sure that, ...
10
votes
1answer
227 views
Handling Java instant Ajax request/respond with Angular
I am trying to build a food search app. I am using Angular and Spring. I am currently using the yelp API, but it's done on the Java side.
I think what I have achieved is really bad design. It works, ...
2
votes
0answers
34 views
Minimizing database overhead by storing additional information to the users authentication-object (Spring Security)
I am using Spring Security in order to check if a logged in user is authenticated. However, after authentication, as some actual requests come in, I would like to minimize the number of database calls ...
6
votes
1answer
7k views
Preventing XSS attacks in a Spring MVC application controller
One of the URL in my application is vulnerable to XSS attack, so I am handling it in the below way.
I created a util class:
...
3
votes
1answer
203 views
Key to Value / Value to Key - java
I want to get the key from value / and value from key ,can anyone help to do in better way ? or can we implement the below code using java enum or spring or apache enumutils or java generic ?
Note : ...
2
votes
3answers
617 views
Adding two different group of objects to a list of groups
I have two lists of Strings and two lists of objects. I need to copy the list of strings to the correspondence list of objects with specific values.
...
4
votes
2answers
597 views
Getting products by category, price, etc
I have the following concerns:
Is Set a good choice for getting products? What are drawbacks of Set for this purpose?
Is it ...
3
votes
1answer
170 views
Customize data types in a generated model with hibernate
I have a Spring/Hibernate application with the following domain class (irrelevant code stripped for brevity):
...
12
votes
1answer
383 views
Java Spring Example Web API
I'd like to get some feedback on an example web API I've put together. It's mavenized and available on GitHub here.
Setup
The only thing you'd have to change to run this locally is line 31 in src/...
1
vote
1answer
524 views
Spring Security Web Configurer Adapter
guys.
The code below is spring security web adapter. I do not like configure(HttpSecurity) method that generates security confirmation policy.
Any ideas to do it more readable and clear?
...
1
vote
1answer
67 views
Simple Spring Service code
I used Spring MVC arch, and I need to be informed about correct names of methods and exceptions throwing.
...