Showing posts with label Annotations. Show all posts
Showing posts with label Annotations. Show all posts

March 11, 2017

#Spring Part 5 : Annotations

What do you mean by  Annotation-based container configuration?
Instead of using XML to describe a bean wiring, we can do the configuration in the component class itself by using annotations on the relevant class, method, or field declaration. The annotation based container configuration acts as an alternative to XML setups.e.g:

@Configuration
public class MyConfig
{
   @Bean
   public MyUserDemo myUserDemo(){
      return new MyUserDemoImpl();
   }
}

November 15, 2016

Java Annotations Interview Questions and Answers

What are Java Annotations?
Java Annotations were added to the java from JDK 5.They allow us to add metadata information into our source code, although they are not a part of the program itself.

An annotation always starts with the symbol @ followed by the annotation name. The symbol @ indicates to the compiler that this is an annotation.