Blocking on ListenableFuture with timeout

I'm using Spring 4.2.3 AsyncRestTemplate.exchange() to call some API that will take several seconds, and i'm expecting that listenableFuture.get(1, TimeUnit.SECONDS) will block for 1 second and then throw TimeOutException. What happens instead is th...
more »

2017-02-16 08:02 (1) Answers

Spring Batch Call DAO Class From Listener Class

I am very new to Spring. i am using spring batch to execute a job. I have configured everything and it is working fine. But i have one problem. From xml configuration i am calling JobListener class to update batch start information. From xml config ...
more »

2017-02-15 05:02 (1) Answers

How to fix on loading spring-context?

What is the possible reason annotation from spring-context cannot find? I already called spring context on my pom file, but upon calling org.springframework.stereotype.Repository my eclipse cannot find it. Any help is much appreciated. Below is my c...
more »

2017-02-13 12:02 (1) Answers

Handling */* content-type in Spring Boot

I am using Spring Controller to handle some requests. I am getting above exception. I have handled application/json, application/xml, etc. But I am not sure about */* and how it should handle in controller. Here is my controller code. @RequestMappin...
more »

2017-02-12 15:02 (1) Answers

Serialize MongoDB ObjectId to string

I'm connecting to MongoDB from a Spring Boot application using mongo-driver 3.2.2. public List<Document> getNodes() { return mongoDatabase.getCollection("nodes").find().into(new ArrayList<Document>()); } ... @RequestMapping("/nodes...
more »

2017-02-10 15:02 (1) Answers

Use custom jackson mapper on spring boot endpoints

I want to use different jackson ObjectMapper instance ( instead of the one used on other mapped urls ) on endpoints derived from AbstractEndpoints. To clarify the question, I don't want to change or customise the object mapper which is used by diff...
more »

2017-02-10 14:02 (2) Answers

Jackson serialize exclude object from list

Following JSON have some parent and child relationship (sample data) "id": 1050 is child because it has "parentId": 1051 "id": 1051 is parent because it has "parentId": null Like this i have huge data { "statusCode": 200, "...
more »

2017-02-07 14:02 (1) Answers

Deploying maven web app in tomcat from Eclipse

I am reading this book where the chapter projects are from github and I'm just importing them into eclipse. The problem is when I run the app on server, I can't find it being deployed on localhost:8082/manager. I've also looked for my project url u...
more »

2017-02-04 22:02 (0) Answers

Spring Boot JSR-303/349 configuration

In my Spring Boot 1.5.1 application I'm trying to configure support of JSR-303 / JSR-349 validation. I have added a following annotations @NotNull @Size(min = 1) to my method: @Service @Transactional public class DecisionDaoImpl extends BaseDao imp...
more »

2017-02-02 09:02 (3) Answers

@ManyToOne, foreign key or both?

This can be a duplicated question, or a very basic one, but I need some help... So I am building an application using spring boot, I have students and classes many students can be in one class so this is a many to one. This what I did: @Entity @D...
more »

2017-01-29 21:01 (1) Answers

Spring data rest and custom representation

I am using the current version of Spring Data Rest (SDR) and Spring Security (SS) and have following entities: User: contains a List of teams joined and another for teams managed. Team: contains a List for members and another for admins. What I w...
more »

2017-01-29 13:01 (0) Answers

Make sure spring component is stateless

We faced a multi-threading problem when a developer introduced mutability to a Spring Component. Something like this: @Component //singleton public class MyComponent { ... private String intermediateResults; public String businessMethod() { ... fil...
more »

2017-01-23 11:01 (2) Answers

JPetShop and Azure Application Insight

I would like to to test the Application Insight tool of Microsoft Azure. For this reason, I took a Spring application, jpetshop (https://github.com/mybatis/jpetstore-6), and I am trying to set up the Application Insight on top of it following this g...
more »

2017-01-22 22:01 (1) Answers

Rich domain model vs anemic domain model

Which is better practice in web development, an anemic domain model or rich domain model? Anemic domain model means entities are dumb POJOs mapped to some persitent storage. Getters and setters doesn't validate the state transition, but trust the la...
more »

2017-01-21 16:01 (0) Answers