Spring
Spring1 Spring 框架中的单例bean是线程安全的吗?不是线程安全的
Spring框架中有一个@Scope注解,默认的值是singleton,单例的
因为一般在spring的bean的中都是注入无状态的对象,没有线程安全的问题。如果在bean中定义了可修改的成员变量,是要考虑到线程安全的问题,可以使用多例或者加锁来解决。
2 什么是AOP?AOP 称为面向切面编程,用于将那些与业务无关,但却对多个对象产生影响的公共行为和逻辑,抽取并封装为一个可重用的模块,这个模块被命名为“切面”( Aspect ),减少系统中的重复代码,降低了模块间的耦合度,同时提高了系统的可维护性。
使用场景:
记录操作日志
缓存处理
spring中内置的事务处理
2.1 Spring中的事务是如何实现的?Spring支持编程式事务管理和声明式事务管理两种方式:
编程式事务控制:需使用Transaction Template来进行实现,对业务的代码又倾入性,项目很少使用
声明式事务管理:声明式事务管理建立再AOP之上的,其本质是通过AOP功能,对方法前后进行拦截,将事务处理的功能编制到拦截的方法 ...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post$ hexo new "My New Post"
More info: Writing
Run server$ hexo server
More info: Server
Generate static files$ hexo generate
More info: Generating
Deploy to remote sites$ hexo deploy
More info: Deployment