Spring 的常見注解有哪些?
注解 |
說明 |
@Component、@Controller、@Service、@Repository |
使用在類上用于實例化Bean |
@Autowired |
使用在字段上用于根據(jù)類型依賴注入 |
@Qualifier |
結(jié)合@Autowired一起使用用于根據(jù)名稱進(jìn)行依賴注入 |
@Scope |
標(biāo)注Bean的作用范圍 |
@Configuration |
指定當(dāng)前類是一個配置類,創(chuàng)建容器時會從該類上加載注解 |
@ComponentScan |
用于指定 Spring?? 在初始化容器時要掃描的包 |
@Bean |
使用在方法上,標(biāo)注將該方法的返回值存儲到Spring容器中 |
@Import |
使用@Import導(dǎo)入的類會被Spring加載到IOC容器中 |
@Aspect、@Before、@After、@Around、@Pointcut |
用于切面編程(AOP) |
SpringMVC常見的注解有哪些?文章來源:http://www.zghlxwxcb.cn/news/detail-532576.html
Springboot常見注解有哪些?文章來源地址http://www.zghlxwxcb.cn/news/detail-532576.html
到了這里,關(guān)于Spring面試題--Spring框架常見注解的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!