Posted In: GSON, JSON

How to use GSON streaming JsonReader to read big JSON file

Usecase – You have JSON data stored at a location. It is big so do not have luxury to read it fully in GSON or you just need use some part of JSON. GSON API provides streaming JsonReader class to do that. Maven Jackson 2X Classes used from GSON com.google.gson.stream.JsonReader Test data Output

Read More

Tags:

by , on August 8th, 2017

Posted In: Jackson 2X, JSON

How to use Jackson 2.X to read big JSON file

Usecase – You have JSON data stored at a location. It is big so do not have luxury to read it fully in ObjectMapper or you just need use some part of JSON. Jackson API provides streaming JSON parser class to do that. Maven Jackson 2X Classes used from Jackson 2X import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; […]

Read More

Tags:

by , on August 8th, 2017

Posted In: Spring, Spring Data

Spring Boot + Spring Data JPA + MySQL + Tomcat – Complexity2

In this example we will see how to insert/update data using JPA and impacts of @Transactional Technologies used 1. Spring Boot 1.5.6 2. Spring data commons 1.13.6 3. Spring data jpa 1.11.6 4. MySQL connector 5.1.43 5. Tomcat JDBC 8.5.16 Steps 1. Create Spring Boot starter project 2. Verify maven pom.xml to have spring-boot-starter, spring-boot-starter-data-jpa, […]

Read More

by , on August 6th, 2017

Posted In: MongoDB, Spring, Spring Data

Spring Boot + Spring Data MongoDB + Embedded MongoDB – Complexity1

Technologies used 1. Spring Boot 1.5.6 2. Spring data commons 1.13.6 3. Spring data mongodb 1.10.6 4. MongoDB driver 3.4.2 5. MongoDB Embedded de.flapdoodle.embed.mongo Steps 1. Create Spring Boot starter project or download and import example source project from this link 2. Verify maven pom.xml to have spring-boot-starter, Spring data mongodb, spring-boot-starter-test and de.flapdoodle.embed 3. […]

Read More

by , on August 5th, 2017

Posted In: Spring, Spring Boot, Spring Data

Spring Boot + Spring Data MongoDB + MongoDB – Complexity1

Technologies used 1. Spring Boot 1.5.6 2. Spring data commons 1.13.6 3. Spring data mongodb 1.10.6 4. MongoDB driver 3.4.2 5. MongoDB server 3.4.6 Steps 1. Create Spring Boot starter project or download and import example source project from this link 2. Verify maven pom.xml to have spring-boot-starter, Spring data mongodb, spring-boot-starter-test 3. Add application […]

Read More

by , on July 28th, 2017

Posted In: Spring, Spring Boot, Spring Data

Spring Boot + Spring Data JPA + MySQL + Tomcat – Complexity1

Technologies used 1. Spring Boot 1.5.6 2. Spring data commons 1.13.6 3. Spring data jpa 1.11.6 4. MySQL connector 5.1.43 5. Tomcat JDBC 8.5.16 Steps 1. Create Spring Boot starter project 2. Verify maven pom.xml to have spring-boot-starter, spring-boot-starter-data-jpa, mysql-connector-java, spring-boot-starter-test 3. Add application properties 4. Map the POJO properties with Database table columns 5. […]

Read More

by , on July 27th, 2017

Posted In: Spring, Spring Security

Example – Spring Boot – Security – Integrating With Apache Directory Server LDAP – SHA Password

  Example shows how to implement login/logout using Apache Directory Server LDAP and Spring Boot. Password is encrypted SHA password. It will be authenticated using LdapShaPasswordEncoder     1. Create Spring boot project. Refer create-eclipse-spring-boot-application-step-by-step     2. Choose LDAP checkbox or add following maven entry     3. Add entry to application.properties     […]

Read More

Tags:

by , on July 25th, 2017

Posted In: Pattern, Spring

Use of strategy pattern in Spring – ContentNegotiationStrategy

Strategy pattern The strategy pattern defines a family of algorithms, encapsulates each algorithm, and makes the algorithms interchangeable within that family. Spring defines following strategy classes which implements ContentNegotiationStrategy FixedContentNegotiationStrategy ParameterContentNegotiationStrategy PathExtensionContentNegotiationStrategy ServletPathExtensionContentNegotiationStrategy Then uses org.springframework.web.accept.ContentNegotiationManager to apply strategy.

Read More

Tags:

by , on July 25th, 2017

Posted In: Pattern, Spring

Use of adapter pattern in Spring – CompletableToListenableFutureAdapter

Adapter pattern Adapter pattern allows the interface of an existing class to be used as another interface. It is often used to make existing classes work with others without modifying their source code. In this example adapter takes CompletableFuture as constructor argument and returns Spring ListenableFuture.  

Read More

Tags:

by , on July 24th, 2017

Posted In: Spring, Spring REST

Spring Asynch Rest Client – Using Apache HTTPComonents library example2

Usecase Application needs to use Apache HTTP Component library to call REST services. Spring provides HttpComponents factory to do that. By default Spring will use default JDK capabilities to call REST services. Maven entry for httpasyncclient  

Read More

Tags:

by , on July 24th, 2017

  • Categories