Posts

Showing posts from April, 2019

Spring

1. Inversion of Control /Dependency Injection :  As a developer you configure the dependencies and container takes care of instantiating and injecting those at runtime. So container is doing your work.  By doing so, you are avoiding lots of boilerplate code. In IoC paradigm, rather than your custom code calling the framework code ( libraries ) , the framework is calling your custom code ( dependencies ). org.springframework.context.ApplicationContext represents the Spring IOC container.  ClassPathXmlApplicationContext  or  FileSystemXmlApplicationContext   are implementations of this interface.  2. To generate starter code for any Spring project you can use following site https://start.spring.io/ 3.  Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity This happens for a couple of reasons. 1. Missing @Id annotation for an Entity. 2. Wrong imported class for...

Fork/Join Framework

Fork/join framework  is for implementing parallel processing in java.  It extends the java 6 multi-threading to take advantage of multiple processors in the hardware. Though it is effective only for problems which are inherently recursive( can be written as recursive ). Till Java 6 , the idea behind multi-threading was to take advantage of free cpu cycles while it is processing one thread/process.  The idea behind fork/join is to maximize the usage of multiple processors. So both are designed with slightly different objectives. You may not even notice the difference in performance if the problem is not really recursive.  fork/join  is also implementation of ExecutorService interface. But it goes one step ahead and takes care of invoking different threads itself in the thread pool rather than developer. It just asks developer to write the tasks in recursive format , it can divide and conquer and run those small -small tasks in different threads in work stea...