久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

Spring @Enable模塊驅動原理及使用實例

瀏覽:5日期:2023-09-01 08:56:35

Spring @Enable 模塊概覽

框架實現 @Enable注解模塊 激活模塊 Spring Framework @EnableWebMvc Web MVC 模塊 @EnableTransactionManagement 事務管理模塊 @EnableCaching Caching 模塊 @EnableMBeanExport JMX 模塊 @EnableAsync 異步處理模塊 @EnableWebFlux Web Flux 模塊 @EnableAspectJAutoProxy AspectJ 代理模塊 Spring Boot @EnableAutoConfiguration 自動裝配 @EnableManagementContext Actuator 管理模塊 @EnableConfigurationProperties 配置屬性綁定模塊 @EnableOAuth2Sso OAuth2 單點登錄模塊 Spring Cloud @EnableEurekaServer Eureka 服務器模塊 @EnableConfigServer 配置服務器模塊 @EnableFeignClients Feign 客戶端模塊 @EnableZuulProxy 服務網關Zuul 模塊 @EnableCircuitBreaker 服務熔斷模塊

理解 @Enable 以 @EnableWebMVC 為例進行理解

定義如下:

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@Documented@Import(DelegatingWebMvcConfiguration.class)public @interface EnableWebMvc {}

發現該注解中引入的 DelegatingWebMvcConfiguration.class

@Configuration(proxyBeanMethods = false)public class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport {...}

public class WebMvcConfigurationSupport implements ApplicationContextAware, ServletContextAware {@Bean@SuppressWarnings('deprecation')public RequestMappingHandlerMapping requestMappingHandlerMapping( @Qualifier('mvcContentNegotiationManager') ContentNegotiationManager contentNegotiationManager, @Qualifier('mvcConversionService') FormattingConversionService conversionService, @Qualifier('mvcResourceUrlProvider') ResourceUrlProvider resourceUrlProvider) { ...}...}

其中 實現類 WebMvcConfigurationSupport.java 中 預定義了 多個 Spring Bean 對象,

隨著 @EnableWebMVC 驅動注解的加載而被加載到 Spring 上下文中從而實現 Spring Web MVC的功能。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
主站蜘蛛池模板: 尤溪县| 临湘市| 方山县| 韶山市| 灵武市| 霍林郭勒市| 雷山县| 呼和浩特市| 孝感市| 丰顺县| 淮南市| 合江县| 昭苏县| 玛纳斯县| 嵊泗县| 哈尔滨市| 庆阳市| 绥滨县| 磐石市| 略阳县| 阳山县| 惠水县| 鄂伦春自治旗| 苏尼特左旗| 五寨县| 莫力| 扬中市| 德江县| 乌海市| 福安市| 广汉市| 双桥区| 南宫市| 东源县| 平安县| 庆阳市| 吐鲁番市| 克什克腾旗| 郓城县| 永丰县| 黄梅县|