? Spring 支持以下4 种类型的过滤方式:
? 注解 org.example.SomeAnnotation 将所有使用SomeAnnotation 注解的类过滤出来
? 类名指定 org.example.SomeClass 过滤指定的类
? 正则表达式 com.kedacom.spring.annotation.web..* 通过正则表达式过滤一些类
? AspectJ 表达式 org.example..*Service+ 通过AspectJ 表达式过滤一些类
? 正则表达式的过滤方式举例: base-package=\ expression=\spring.annotation.web..*\>
? 注解的过滤方式举例:
expression=\ expression=\ expression=\
启用Spring MVC 注解
? 启动Spring MVC 的注解功能,完成请求和注解POJO 的映射 ? class=\odHandlerAdapter\ 注解介绍 ? @Controller ? @Service ? @Autowired ? @RequestMapping ? @RequestParam ? @ModelAttribute ? @Cacheable ? @CacheFlush ? @Resource ? @PostConstruct ? @PreDestroy ? @Repository ? @Component (不推荐使用) ? @Scope ? @SessionAttributes ? @InitBinder @Component是通用标注,@Controller标注web控制器,@Service标注Servicec层的服务,@Respository标注DAO层的数据访问 @Controller ? 例如 @Controller public class SoftCreateController extends SimpleBaseController {} ? 或者 @Controller(\ ? 说明 @Controller 负责注册一个bean 到spring 上下文中,bean 的ID 默认为类名称开头字母小写 @Service ? 例如 @Service public class SoftCreateServiceImpl implements ISoftCreateService {} ? 或者 @Service(\ ? 说明 @Service 负责注册一个bean 到spring 上下文中,bean 的ID 默认为类名称开头字母小写 @Autowired ? 例如 @Autowired private ISoftPMService softPMService; ? 或者 @Autowired(required=false) private ISoftPMService softPMService = new SoftPMServiceImpl(); ? 说明 @Autowired 根据bean 类型从spring 上线文中进行查找,注册类型必须唯一,否则报异常。与@Resource 的区别在于,@Resource 允许通过bean 名称或bean 类型两种方式进行查找@Autowired(required=false) 表示,如果spring 上下文中没有找到该类型的bean 时, 才会使用new SoftPMServiceImpl(); @RequestMapping ? 类