-->

IBM Integration Bus (IBM Message Broker)

This site is under construction

Wednesday, December 21, 2016

Spring Questions


Q) Why do we need DTD or XSD declaration tags in the spring XML configuration file?

A)  Either we need to declare DTD at the top level or XSD inside beans root tag
·         DTD and XSD are used to validate our XML file.
·         Inside IOC we have SAX parser which parsers XML file.  SAX parser will read and parsers XML file.
·         To parser the XML file it should be in the well-formed XML file (means having close and end tag) so DTD or XSD is used to check the XML file in the well-formed file and check the valid file which is nothing but tags without a declaration.



Q) What is the use of container in Spring?
A) The container in spring is responsible for reading the XML file and creating the instances(objects)  of the respective beans in the XML file. The container is responsible for bean life.


Q) How many containers we have in IOC?
A)   In IOC, we have mainly two containers
·         Core Container (Bean Factory)
·         J2ee container (Application Context)

Q)  what is the difference between BeanFactory(Core Container) and ApplicationContext(J2EE container) ?

A) Application Context build on the top of BeanFactoryContainer

·         Bean Factory will create the object for the first user request. That means it won’t create an object at the time of loading. By default, bean scope is a singleton.
·         Application Context container will create object while loading itself if the beans scopes is a singleton.
·          if we change the bean’s scope in Application Context to prototype. It will not create the objects for the POJO class while loading the XML file.
·         If bean scope is equal to the porotype Application context behaves like Bean factory. It will create each object for each request.
·         BeanFactory will create an instance(objects) whenever call get bean method but ApplicationContext creates instance while loading the XML file into the container.

·         By default, the scope of the bean singleton. If the scope of the bean is singleton the Bean Factory Container will create an object for the POJO class on-demand that mean when we call the bean method (get bean) but in case of application context container if the scope is singleton application context container will create the objects for the POJO class at the time of loading the XML file.

·         If the scope of the bean is prototype than both containers creates the objects, the one demand only and different objects for each user.

·         If we have 10 beans in my XML documents than bean factory container will create one object when we called get bean method and that one object will have used for the remaining 9 beans. so remaining 9 beans have to wait for first one complete so it will take a lot of time to give a response to all user at a time but in case of application context if I have 10 beans it will create 10 objects at the time of loading the XML so if it uses the response to 10 users same time so there is no time delay when the scope of the of a bean is a singleton.

·         When the bean scope is a prototype in the Application Context Container it will create the instance when a user requested get bean method. In this scenario both containers Bean Factory and Application Context behaves same

·         In containers when we called get bean method in IOC container by using class. for name container creates an object. when class is public  


Q) What is a POJO class?

A)  POJO Plain Old Java Object. Basically, a class with attributes and its getters and setters.


Q) Autowired Annotation in spring?
A)  Autowired annotation can be implemented in web applications. We can not implement Autowired in standalone application because to access objects inside the static method we need an instance of the class when you use autowired  instance is created after loading application context or configuration file. 



Friday, November 18, 2016

Shell Scripting tutorial




Refer:

https://www.youtube.com/watch?v=nVt3Rst-2H8&list=PL7B7FA4E693D8E790&index=1


Command for sudo user:

                    sudo su - <userName>


Copying file from once location to another Location:
   
         Go the source folder directory of the file which you want to copy and then use below command:

                  cp <sourceFileName> <Pathofthe destinationFolderToCopytheFiles>


Thursday, November 17, 2016

General Technical FAQ'S


                                

1)  How to delete the empty page in the word document?

Sol: 
  Reference: 

            https://www.youtube.com/watch?v=AtfSoUdjmII


2) Command used to make windows command line full screen?

Sol)  wmic(Windows Management Instrumentation Command line)

Step1: type wmic in the command line and then enter. It will take you   "wmic:root\cli>" directory.

Step2. Enter exit in the command line prompt to go back you are working directory.


3) Command to know about computer/laptop specifications? 

A) Go to the command prompt in your system and enter the below command.

    dxdiag 

Wednesday, August 31, 2016

Core Java



1. what is the access modifiers/specifiers or what is the difference between them?

A) Access modifiers/specifiers:
               








         JVM(java virtual machine) Architecture 


            
                   





 Reference 

                   https://www.youtube.com/watch?v=dncpVFP1JeQ





Q) Difference between array and ArrayList in java?
Sol:
   Refer:
      
http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html



Q)  What is Generics in java and what is use of the Generics?

sol:

 Reference:    
http://www.javatpoint.com/generics-in-java





Q) Difference between DAO and DTO in Java?
Sol:
      Data Access Object (DAO)
      DAO is a class that usually has the CRUD operations like save, update, delete.

     Data Transfer Object (DTO).
     The DTO is just an object that holds data. It is really a bean with instance variables and setter and getters.


 Reference:
   https://coderanch.com/t/99834/difference-DTO-DAO


Q) AutoBoxing and AutoUnboxing in Java?



AutoBoxing(wrapping):
·         Converting  primitive data types into reference type or corresponding object wrapper class is called AutoBoxing
·         Java compiler performs automatic conversation.
·         Ex:      int a= 10;
          Integer b = a:
·         Here we are assigning primitive value to object type. Internally java compiler converts below conversation operation.
       Integer b = Integer.valueOf (a);

AutoUnBoxing(unwrapping):
·         Converting  reference type or object  of wrapper class into primitive data types is called AutoUnBoxing
·         Java compiler performs automatic conversation.
·         Ex:      Integer a= 100;
             int b = a:
·         Here we are assigning object to primitive type. Internally java compiler converts below conversation operation.
       int b =a.intValue();
·         Using reference type will reduces performance because it has to recreate the object first then memory created in the heap.
·         Primitive types will have default values so need of checking null check on the primitive types.
Ex: int a;
Means int default value is 0
·         Object types of default values are null. We have to apply null check object/reference types.
·         All primitive types will have corresponding wrapper class.


Q) Generics  in Java ?
Generics:
·         The purpose of Generics is to provide Type Safety and to resolve typecasting.
·         Arrays are type safety that means it will store only specified data type in the array but the size is fixed.
Ex: Array[String ]  a = new [String](10);
·         Collections are not type safety which means it can store any kind of data type.
·         To achieve  above  two draw backs in arrays and collections Generics are introduced which generics is type safety and size is not fixed.
Ex:  Box<Integer> integerBox = new Box<Integer>();
·         Generics will accept only object type but not primitive types.
Ex: List<Integer> a = new Arraylist<>();  correct
       List<int> a = new Arraylist<>();  is wrong because int is primitive type.   


Q)  How to print the  SQL query which is used in hibernate or spring in the console using log4j?
 A) log4j.logger.org.hibernate.SQL=debug
 


Q) how to add jar to M2 repository manually ?
A)
mvn install:install-file -Dfile=<physical location of the jar file with name> -DgroupId=<groupId> -DartifactId=<artifactId> -Dversion=<version> -Dpackaging=jar