Spring - Interface

Why interface in Spring:

  • As we know, the core concept of spring is DI. To achieve this we have to go for interface.
  • And Interface gives us better readability.
  • And we can give multiple implementation and we can use to inject in another bean using qualifier seperation.
eg.
@Autowired
@Qualifier ("jdbcdevice")
private DeviceDao device;
     (or)
@Resource(name = "jdbcdevice")
private DeviceDao device;

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab