Required feature in Autowiring

@Autowired has an argument called required=boolean value By default it is set to true . we can explicitely make it false if we want. If it is true(default behavior) then dependent bean should be available otherwise it throws exception Example package com.kb.autowiringAnnotation;   import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier;   public class Person {       […]

Share this article on

Configuring spring beans without XML

We have a class Person package com.kb.java_based_configuration;   public class Person {   } package com.kb.java_based_configuration; public class Person { } Now I want to make this as a spring bean. I can do it using xml as follows Method 1 <?xml version="1.0" encoding="UTF-8"?>   <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:context="http://www.springframework.org/schema/context"     […]

Share this article on
Next >