What is Mbean?

This lesson introduces the fundamental concept of the JMX API, namely managed beans, or MBeans.
An MBean is a managed Java object, similar to a JavaBeans component, that follows the design patterns set forth in the JMX specification. An MBean can represent a device, an application, or any resource that needs to be managed. MBeans expose a management interface that consists of the following:
  • A set of readable or writable attributes, or both.
  • A set of invokable operations.
  • A self-description.
The management interface does not change throughout the life of an MBean instance. MBeans can also emit notifications when certain predefined events occur.
The JMX specification defines five types of MBean:
  • Standard MBeans
  • Dynamic MBeans
  • Open MBeans
  • Model MBeans
  • MXBeans

What is Annotation-based container configuration?

An alternative to XML setups is provided by annotation-based configuration which relies on the bytecode metadata for wiring up components instead of angle-bracket declarations. Instead of using XML to describe a bean wiring, the developer moves the configuration into the component class itself by using annotations on the relevant class, method, or field declaration

Can you inject null and empty string values in Spring?

 Yes.

What are the limitations with autowiring?

 Limitations of autowiring are: Overriding possibility: You can still specify dependencies using and settings which will always override autowiring. Primitive data types: You cannot autowire so-called simple properties such as primitives, Strings, and Classes. Confusing nature: Autowiring is less exact than explicit wiring, so if possible prefer using explicit wiring.

What are different Modes of auto wiring?

The autowiring functionality has five modes which can be used to instruct Spring container to use autowiring for dependency injection: no: This is default setting which means no autowiring and you should use explicit bean reference for wiring. You have nothing to do special for this wiring. This is what you already have seen in Dependency Injection chapter. byName: Autowiring by property name. Spring container looks at the properties of the beans on which autowire attribute is set to byName in the XML configuration file. It then tries to match and wire its properties with the beans defined by the same names in the configuration file. byType: Autowiring by property datatype. Spring container looks at the properties of the beans on which autowire attribute is set to byType in the XML configuration file. It then tries to match and wire a property if its type matches with exactly one of the beans name in configuration file. If more than one such beans exist, a fatal exception is thrown. constructor: Similar to byType, but type applies to constructor arguments. If there is not exactly one bean of the constructor argument type in the container, a fatal error is raised. autodetect: Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to autowire by byType.