项目结构
controller层代码
@Controller
@RequestMapping("/customer")
public class CustomerController {

@Autowired
private CustomerService customerService;

@Value("${customer.from.type}")
private String Source;
@Value("${customer.dict.industry}")
private String industry;
@Value("${customer.dict.level}")
private String level;

@RequestMapping("/list")
public String list(QueryVo vo,Model model) throws Exception{
//客户来源
List<BaseDict> sourceList =customerService.findDictByCode(Source);

//所属行业
List<BaseDict> industryList =customerService.findDictByCode(industry);

//客户级别
List<BaseDict> levelList=customerService.findDictByCode(level);

if(null !=vo.getCustName()) {
vo.setCustName(new String(vo.getCustName().getBytes("iso8859-1"),"utf-8"));
}


model.addAttribute("fromType", sourceList);
model.addAttribute("industryType", industryList);
model.addAttribute("levelType", levelList);

model.addAttribute("custName", vo.getCustName());
model.addAttribute("custSource", vo.getCustSource());
model.addAttribute("custIndustry", vo.getCustIndustry());
model.addAttribute("custLevel", vo.getCustLevel());
return "customer";
}}
applicationContext-service.xml配置
<!-- @Service扫描 -->
<context:component-scan base-package="com.huawei.crm.service"></context:component-scan>springmvc.xml文件配置
    <!-- 引入字典资源文件 -->
    <context:property-placeholder location="classpath:resource.properties"/>
    
    <!-- @Controller注解扫描 -->              
    <context:component-scan base-package="com.huawei.crm.controller"></context:component-scan>
    
    <!-- 注解驱动:
     替我们显示的配置了最新版的注解的处理器映射器和处理器适配器 -->
    <mvc:annotation-driven conversion-service="conversionService"></mvc:annotation-driven>
    
    <!-- 配置视图解析器 
作用:在controller中指定页面路径的时候就不用写页面的完整路径名称了,可以直接写页面去掉扩展名的名称
-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 真正的页面路径 =  前缀 + 去掉后缀名的页面名称 + 后缀 -->
<!-- 前缀 -->
<property name="prefix" value="/WEB-INF/jsp/"></property>
<!-- 后缀 -->
<property name="suffix" value=".jsp"></property>
</bean>

<bean id="conversionService"
class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
<property name="converters">
<set>
<bean class="com.huawei.crm.controller.converter.CustomGlobalStrToDateConverter"/>
</set>
</property>
</bean>web.xml文件中的配置
<!-- 加载spring容器 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:ApplicationContext-*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
  
  
  <!-- springmvc前端控制器 -->
  <servlet>
   <servlet-name>springMvc</servlet-name>
   <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
   <init-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>classpath:SpringMvc.xml</param-value>
   </init-param>
   <!-- 在tomcat启动的时候就加载这个servlet -->
   <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
   <servlet-name>springMvc</servlet-name>
   <!-- 
   *.action    代表拦截后缀名为.action结尾的
   /  拦截所有但是不包括.jsp
   /*  拦截所有包括.jsp
    -->
   <url-pattern>*.action</url-pattern>
  </servlet-mapping>
  
  <!-- 配置Post请求乱码 -->
  <filter>
<filter-name>CharacterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>报的错误org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.huawei.crm.service.CustomerService com.huawei.crm.controller.CustomerController.customerService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.huawei.crm.service.CustomerService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
已经尝试过将@Autowired修改为@Resource,但是还是报这个错误。包名是自己瞎取的!!!