title: Spring 4.3 auto wiring not working
body: <p>As per my experience in Spring <code>&lt;context:component-scan base-package="&lt;package name&gt;"/&gt;</code> is enough in application context and through <code>@Autowired</code> beans will able to inject.</p>
  
  <p>But Now I am using Spring 4.3 and configuring application context thru xml.
  Then bean is null (not injected).</p>
  
  <p><strong>If I remove comment in application context, bean will be available.</strong> </p>
  
  <p>See the xml and my resource class here.</p>
  
  <pre><code>&lt;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"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
  http://www.springframework.org/schema/context
  http://www.springframework.org/schema/context/spring-context-4.3.xsd"&gt;
  
  &lt;context:component-scan base-package="com.mcp.rest.jersy2.service.*"/&gt;
  
  &lt;!-- 
  &lt;bean id ="userService" class = "com.mcp.rest.jersy2.service.UserServiceImpl"&gt;&lt;/bean&gt;
   --&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>@Path("/service")
  @Component
  public class UserServiceResource {
  
  private static final String text = "Message from Server :%s ";
  
  @Autowired
  private UserService userService;
  
  
  @GET
  @Path("{name}")
  @Consumes(MediaType.TEXT_PLAIN)
  public Response getMsg(@PathParam("name") String name) {
      String response = String.format(text, name);
      return Response.status(Response.Status.OK).entity(response).type(MediaType.TEXT_PLAIN).build();
  }
  
  
  public UserService getUserService() {
      return userService;
  }
  
  
  public void setUserService(UserService userService) {
      this.userService = userService;
  }
  }
  </code></pre>
  
  <p>what is the problem?</p>
  
  <p>Service class:</p>
  
  <pre><code>package com.mcp.rest.jersy2.service;
  
  import org.springframework.stereotype.Service;
  
  @Service
  public class UserServiceImpl implements UserService 
  {
  
   }
  </code></pre>
  
  <p><strong>IGNORE NOW</strong></p>
  
  <p>My Component scan was issue. I need to cover the package where beans are injecting.</p>
  
  <p>I reduced </p>
  
  <p><code>&lt;context:component-scan base-package="com.mcp.rest.jersy2.service.*"/&gt;</code></p>
  
  <p>to </p>
  
  <pre><code>&lt;context:component-scan base-package="com.mcp.rest.jersy2.*"/&gt;
  </code></pre>