spring标签(@value,@Service,@requestMapping,@repository),mybaitis各层的关系
1、@Value
这个标签可以把properties中的数据注入到变量中。
@Value("${mail_host}")
private String host;
通过上述这个方法,mail_host就可以注入到host中。
2、@Service与@Transactional
@Service主要用于标注业务层。(而且标注的是类)
@Transactional表示需要有业务管理
@Service
@Transactional
public class AnswerServiceImpl ;
3、@Repository(放于dao层)
将dao层自动标注为spring bean,并且进行spring扫描。
4、@Controller与@RequestMapping("/collection")
@Controller
@RequestMapping("/collection")
public class CollectionController
controller层主要放与前端链接的业务代码,通过requestMapping进行注解,前端只要找到/collection的路径,就会进入这个controller层。
5、