最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

springMVC之HandlerExceptionResolver使用

 更新時間:2022年11月16日 10:01:12   作者:原之殤  
這篇文章主要介紹了springMVC之HandlerExceptionResolver使用,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

請求異常的處理

Handler查找以及執(zhí)行期間可能會出現(xiàn)異常,需要對其進(jìn)行處理,HandlerExceptionResolver就被設(shè)計(jì)出來了,

大致邏輯如下:

// 此段邏輯可以在dispatcherServlet中找到相似部分
ModelAndView mv = null;
try{
?? ?mv = hanlder.handle();
}catch(Exception e){
?? ?mv = handlerExceptionResolver.handle();
}

springMVC也是這么設(shè)計(jì)的,當(dāng)然比這要復(fù)雜一點(diǎn),我們先來看一下HandlerExceptionResolver這個接口設(shè)計(jì)。

public interface HandlerExceptionResolver {
? ? // 處理異常,返回視圖信息
?? ?@Nullable
?? ?ModelAndView resolveException(
?? ??? ??? ?HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex);
}

可用的HandlerExceptionResolver

HandlerExceptionResolver族譜

AbstractHandlerExceptionResolver這個抽象類的設(shè)計(jì)可以幫助我們針對不同的handler配置不同的HandlerExceptionResolver。

// AbstractHandlerExceptionResolver中解析異常的實(shí)現(xiàn)
public ModelAndView resolveException(
			HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {
		// 檢查這個解析器是否適用于這個處理器
		if (shouldApplyTo(request, handler)) {
			// 添加響應(yīng)頭,阻止響應(yīng)緩存
			prepareResponse(ex, response);
			// 解析異常 交給子類覆蓋實(shí)現(xiàn)
			ModelAndView result = doResolveException(request, response, handler, ex);
			// 日志記錄,這里我將代碼省略了
			return result;
		}else {
			return null;
		}
	}

protected boolean shouldApplyTo(HttpServletRequest request, @Nullable Object handler) {
		if (handler != null) {
			// 可以通過設(shè)置mappedHandlers或mappedHandlerClasses來指定只為某個handler解析
			if (this.mappedHandlers != null && this.mappedHandlers.contains(handler)) {
				return true;
			}
			if (this.mappedHandlerClasses != null) {
				for (Class<?> handlerClass : this.mappedHandlerClasses) {
					if (handlerClass.isInstance(handler)) {
						return true;
					}
				}
			}
		}
		// 這里就是判斷mappedHandlers或mappedHandlerClasses是否為空,都為空返回false
		// 意味著異常解析器可以適用于任何handler
		return !hasHandlerMappings();
	}

接下來我們來看看不同子類對于doResolveException方法的實(shí)現(xiàn)。

1. SimpleMappingExceptionResolver

首先我們來看一下該類提供了哪些屬性供我們進(jìn)行設(shè)置。

?? ?// 1 配置的異常映射 key為異常名稱 value為視圖名稱
?? ?private Properties exceptionMappings;
?? ?// 2 排除的異常類型數(shù)組
?? ?private Class<?>[] excludedExceptions;
?? ?// 3 默認(rèn)的錯誤視圖名稱
?? ?private String defaultErrorView;
?? ?// 4 默認(rèn)的響應(yīng)狀態(tài)碼
?? ?private Integer defaultStatusCode;
?? ?// 5 key為異常名,value為響應(yīng)狀態(tài)碼
?? ?private Map<String, Integer> statusCodes = new HashMap<>();
protected ModelAndView doResolveException(
?? ??? ??? ?HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {
?? ??? ?// 確定視圖名稱。
?? ??? ?String viewName = determineViewName(ex, request);
?? ??? ?if (viewName != null) {
?? ??? ??? ?// 根據(jù)視圖名稱去statusCodes中確定響應(yīng)狀態(tài)碼
?? ??? ??? ?Integer statusCode = determineStatusCode(request, viewName);
?? ??? ??? ?if (statusCode != null) {
?? ??? ??? ??? ?applyStatusCodeIfPossible(request, response, statusCode);
?? ??? ??? ?}
?? ??? ??? ?return getModelAndView(viewName, ex, request);
?? ??? ?}else {
?? ??? ??? ?return null;
?? ??? ?}
?? ?}
protected String determineViewName(Exception ex, HttpServletRequest request) {
?? ??? ?String viewName = null;
?? ??? ?// 如果排除的異常數(shù)組中包含發(fā)生的異常,則返回null
?? ??? ?if (this.excludedExceptions != null) {
?? ??? ??? ?for (Class<?> excludedEx : this.excludedExceptions) {
?? ??? ??? ??? ?if (excludedEx.equals(ex.getClass())) {
?? ??? ??? ??? ??? ?return null;
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ??? ?// 檢查特定的異常映射。
?? ??? ?if (this.exceptionMappings != null) {
?? ??? ??? ?viewName = findMatchingViewName(this.exceptionMappings, ex);
?? ??? ?}
?? ??? ?// 定義了默認(rèn)錯誤視圖
?? ??? ?if (viewName == null && this.defaultErrorView != null) {
?? ??? ??? ?viewName = this.defaultErrorView;
?? ??? ?}
?? ??? ?return viewName;
?? ?}
protected String findMatchingViewName(Properties exceptionMappings, Exception ex) {
?? ??? ?String viewName = null;
?? ??? ?String dominantMapping = null;
?? ??? ?int deepest = Integer.MAX_VALUE;
?? ??? ?for (Enumeration<?> names = exceptionMappings.propertyNames(); names.hasMoreElements();) {
?? ??? ??? ?String exceptionMapping = (String) names.nextElement();
?? ??? ??? ?// depth =0 表示剛好找到;depth =-1 表示沒找到,這是一個遞歸方法,
?? ??? ??? ?// 會一直沿著異常的繼承結(jié)構(gòu)向上找,每向上一層,depth+1
?? ??? ??? ?int depth = getDepth(exceptionMapping, ex);
?? ??? ??? ?if (depth >= 0 && (depth < deepest || (depth == deepest &&
?? ??? ??? ??? ??? ?dominantMapping != null && exceptionMapping.length() > dominantMapping.length()))) {
?? ??? ??? ??? ?// 這里將深度賦值了,意味著一旦有匹配的異常結(jié)果時,即使下一次更匹配,但是
?? ??? ??? ??? ?// depth < deepest這個條件也無法滿足
?? ??? ??? ??? ?deepest = depth;
?? ??? ??? ??? ?dominantMapping = exceptionMapping;
?? ??? ??? ??? ?viewName = exceptionMappings.getProperty(exceptionMapping);
?? ??? ??? ?}
?? ??? ?}
?? ??? ?return viewName;
?? ?}
?? ?private int getDepth(String exceptionMapping, Class<?> exceptionClass, int depth) {
?? ??? ?// 需要注意,這里使用的是contains,如果異常名稱不適用全限定名
?? ??? ?// 一旦出現(xiàn)多個異常映射項(xiàng)匹配的情況,將直接選擇第一個匹配的結(jié)果
?? ??? ?if (exceptionClass.getName().contains(exceptionMapping)) {
?? ??? ??? ?return depth;
?? ??? ?}
?? ??? ?if (exceptionClass == Throwable.class) {
?? ??? ??? ?return -1;
?? ??? ?}
?? ??? ?return getDepth(exceptionMapping, exceptionClass.getSuperclass(), depth + 1);
?? ?}

demo

/**
?* 通過SimpleMappingExceptionResolver做全局異常處理
?*/
@Configuration
public class ExceptionConfig {
?? ?@Bean
?? ?public SimpleMappingExceptionResolver simpleMappingExceptionResolver() {
?? ??? ?SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver();?? ??? ?
?? ??? ?Properties exceptionMappings= new Properties();?? ??? ?
?? ??? ?/**
?? ??? ? * 這里是不建議的使用方式,如果出現(xiàn)異常java.lang.ArithmeticException,最終得到的視圖卻為
?? ??? ? * error,這是我們不希望的,所以請使用全限定名
?? ??? ? */
?? ??? ?mappers.put("Exception", "error");
?? ??? ?mappers.put("ArithmeticException", "error1");
?? ??? ?mappers.put("java.lang.ArithmeticException", "error2");
?? ??? ?resolver.setExceptionMappings(exceptionMappings);
?? ??? ?resolver.setDefaultErrorView("error3");
?? ??? ?return resolver;
?? ?}
}

2. DefaultHandlerExceptionResolver

(解決標(biāo)準(zhǔn)的Spring MVC異常并將其轉(zhuǎn)換為相應(yīng)的HTTP狀態(tài)碼),使用時我們不用設(shè)置order,默認(rèn)的最小的優(yōu)先級。

protected ModelAndView doResolveException(
?? ??? ??? ?HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {
?? ??? ?try {
?? ??? ??? ?if (ex instanceof HttpRequestMethodNotSupportedException) {
?? ??? ??? ??? ?return handleHttpRequestMethodNotSupported(
?? ??? ??? ??? ??? ??? ?(HttpRequestMethodNotSupportedException) ex, request, response, handler);
?? ??? ??? ?}
?? ??? ??? ?// 這里有很多if語句,就是針對標(biāo)準(zhǔn)的Spring MVC異常,返回對應(yīng)的狀態(tài)碼進(jìn)行處理
?? ??? ?}catch (Exception handlerEx) {
?? ??? ??? ?// 日志打印...
?? ??? ?}
?? ??? ?return null;
?? ?}

3. ResponseStatusExceptionResolver

protected ModelAndView doResolveException(
?? ??? ??? ?HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) {
?? ??? ?try {
?? ??? ??? ?if (ex instanceof ResponseStatusException) {
?? ??? ??? ??? ?return resolveResponseStatusException((ResponseStatusException) ex, request, response, handler);
?? ??? ??? ?}
?? ??? ??? ?// 找到異常上使用的ResponseStatus注解
?? ??? ??? ?ResponseStatus status = AnnotatedElementUtils.findMergedAnnotation(ex.getClass(), ResponseStatus.class);
?? ??? ??? ?if (status != null) {
?? ??? ??? ??? ?return resolveResponseStatus(status, request, response, handler, ex);
?? ??? ??? ?}
?? ??? ??? ?// ResponseStatus為空,異常鏈仍未結(jié)束,遞歸調(diào)用
?? ??? ??? ?if (ex.getCause() instanceof Exception) {
?? ??? ??? ??? ?return doResolveException(request, response, handler, (Exception) ex.getCause());
?? ??? ??? ?}
?? ??? ?}catch (Exception resolveEx) {
?? ??? ??? ?...
?? ??? ?}
?? ??? ?return null;
?? ?}

ResponseStatus注解使用方式挺多的,這里是其中一種,就是在自定義異常的類上添加此注解。還有其他用法大家可以去看看這篇文章,@ResponseStatus注解的更多用法。

4. ExceptionHandlerExceptionResolver

在看這個類解析異常的方法之前,我們先認(rèn)識一下兩個緩存,分別為局部和全局異常方法解析器映射緩存,源碼中也就是這兩個變量。

?? ?// 局部異常方法解析器緩存,下面統(tǒng)稱為局部緩存
?? ?private final Map<Class<?>, ExceptionHandlerMethodResolver> exceptionHandlerCache =
?? ??? ??? ?new ConcurrentHashMap<>(64);
?? ?// 全局異常方法解析器緩存,下面統(tǒng)稱為全局緩存
?? ?private final Map<ControllerAdviceBean, ExceptionHandlerMethodResolver> exceptionHandlerAdviceCache =
?? ??? ??? ?new LinkedHashMap<>();

全局緩存在bean初始化的時候就會加載,將會把容器中含有注解ControllerAdvice的bean收集起來。

?? ?// bean 初始化的時候會加載這個方法
?? ?public void afterPropertiesSet() {
?? ??? ?// 初始化全局緩存
?? ??? ?initExceptionHandlerAdviceCache();
?? ??? ?if (this.argumentResolvers == null) {
?? ??? ??? ?// 設(shè)置請求參數(shù)解析器
?? ??? ?}
?? ??? ?if (this.returnValueHandlers == null) {
?? ??? ??? ?// 設(shè)置返回值解析器
?? ??? ?}
?? ?}

?? ?private void initExceptionHandlerAdviceCache() {
?? ??? ?if (getApplicationContext() == null) {
?? ??? ??? ?return;
?? ??? ?}
?? ??? ?// 獲取含有注解ControllerAdvice的bean
?? ??? ?List<ControllerAdviceBean> adviceBeans = ControllerAdviceBean.findAnnotatedBeans(getApplicationContext());
?? ??? ?for (ControllerAdviceBean adviceBean : adviceBeans) {
?? ??? ??? ?Class<?> beanType = adviceBean.getBeanType();
?? ??? ??? ?if (beanType == null) {
?? ??? ??? ??? ?throw new IllegalStateException("Unresolvable type for ControllerAdviceBean: " + adviceBean);
?? ??? ??? ?}
?? ??? ??? ?ExceptionHandlerMethodResolver resolver = new ExceptionHandlerMethodResolver(beanType);
?? ??? ??? ?if (resolver.hasExceptionMappings()) {
?? ??? ??? ??? ?// 加入全局緩存
?? ??? ??? ??? ?this.exceptionHandlerAdviceCache.put(adviceBean, resolver);
?? ??? ??? ?}
?? ??? ??? ?// MARK:如果該類實(shí)現(xiàn)了ResponseBodyAdvice接口
?? ??? ??? ?if (ResponseBodyAdvice.class.isAssignableFrom(beanType)) {
?? ??? ??? ??? ?this.responseBodyAdvice.add(adviceBean);
?? ??? ??? ?}
?? ??? ?}
?? ??? ?// ...
?? ?}

有關(guān)MARK部分ResponseBodyAdvice接口的用處,這里不展開了。

而局部緩存是在解析異常的方法中動態(tài)加載的。

?? ?protected ModelAndView doResolveHandlerMethodException(HttpServletRequest request,
?? ??? ??? ?HttpServletResponse response, @Nullable HandlerMethod handlerMethod, Exception exception) {
?? ??? ?// 根據(jù)異常類型,處理器找到處理異常的方法
?? ??? ?ServletInvocableHandlerMethod exceptionHandlerMethod = getExceptionHandlerMethod(handlerMethod, exception);
?? ??? ?// 異常方法調(diào)用...
?? ??? ?// 返回ModelAndView...
?? ?}
protected ServletInvocableHandlerMethod getExceptionHandlerMethod(
?? ??? ??? ?@Nullable HandlerMethod handlerMethod, Exception exception) {
?? ?if (handlerMethod != null) {
?? ??? ??? ?handlerType = handlerMethod.getBeanType();
?? ??? ??? ?// 從局部緩存中查找,找不到,則構(gòu)建一個
?? ??? ??? ?ExceptionHandlerMethodResolver resolver = this.exceptionHandlerCache.get(handlerType);
?? ??? ??? ?if (resolver == null) {
?? ??? ??? ??? ?resolver = new ExceptionHandlerMethodResolver(handlerType);
?? ??? ??? ??? ?this.exceptionHandlerCache.put(handlerType, resolver);
?? ??? ??? ?}
?? ??? ??? ?// 解析異常獲取對應(yīng)方法
?? ??? ??? ?Method method = resolver.resolveMethod(exception);
?? ??? ??? ?if (method != null) {
?? ??? ??? ??? ?return new ServletInvocableHandlerMethod(handlerMethod.getBean(), method);
?? ??? ??? ?}
?? ??? ??? ?// 如果是代理類,則要獲取到原目標(biāo)類型
?? ??? ??? ?if (Proxy.isProxyClass(handlerType)) {
?? ??? ??? ??? ?handlerType = AopUtils.getTargetClass(handlerMethod.getBean());
?? ??? ??? ?}
?? ??? ?}
?? ??? ?// 局部緩存沒有找到,則去全局緩存中找
?? ??? ?for (Map.Entry<ControllerAdviceBean, ExceptionHandlerMethodResolver> entry : this.exceptionHandlerAdviceCache.entrySet()) {
?? ??? ??? ?ControllerAdviceBean advice = entry.getKey();
?? ??? ??? ?// MARK:檢查是否應(yīng)該通過給定的bean類型?
?? ??? ??? ?if (advice.isApplicableToBeanType(handlerType)) {
?? ??? ??? ??? ?ExceptionHandlerMethodResolver resolver = entry.getValue();
?? ??? ??? ??? ?Method method = resolver.resolveMethod(exception);
?? ??? ??? ??? ?if (method != null) {
?? ??? ??? ??? ??? ?return new ServletInvocableHandlerMethod(advice.resolveBean(), method);
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ?return null;
}?? ??? ?

上述代碼MARK部分涉及到另一知識點(diǎn),有關(guān)注解ControllerAdvice的設(shè)置部分,這里就不展開了。

同前面一樣,在看解析異常獲取對應(yīng)方法前,我先介紹另一個緩存-異常映射方法緩存。這個緩存在ExceptionHandlerMethodResolver實(shí)例化的時候被加載。

?? ?// 用于選擇@ExceptionHandler方法的過濾器。
?? ?public static final MethodFilter EXCEPTION_HANDLER_METHODS = method ->
?? ??? ??? ?AnnotatedElementUtils.hasAnnotation(method, ExceptionHandler.class);
?? ?// 異常映射方法緩存 key為異常類型 value為方法 ?? ??? ?
?? ?private final Map<Class<? extends Throwable>, Method> mappedMethods = new HashMap<>(16);
?? ?
?? ?public ExceptionHandlerMethodResolver(Class<?> handlerType) {
?? ??? ?for (Method method : MethodIntrospector.selectMethods(handlerType, EXCEPTION_HANDLER_METHODS)) {
?? ??? ??? ?// 檢測方法映射的異常
?? ??? ??? ?for (Class<? extends Throwable> exceptionType : detectExceptionMappings(method)) {
?? ??? ??? ??? ?// 加入緩存
?? ??? ??? ??? ?addExceptionMapping(exceptionType, method);
?? ??? ??? ?}
?? ??? ?}
?? ?}
?? ?
?? ?private List<Class<? extends Throwable>> detectExceptionMappings(Method method) {
?? ??? ?List<Class<? extends Throwable>> result = new ArrayList<>();
?? ??? ?// 獲取注解ExceptionHandler的value屬性
?? ??? ?detectAnnotationExceptionMappings(method, result);
?? ??? ?// 如果注解value沒有設(shè)置
?? ??? ?if (result.isEmpty()) {
?? ??? ??? ?for (Class<?> paramType : method.getParameterTypes()) {
?? ??? ??? ??? ?// 方法參數(shù)中需要設(shè)置異常字段
?? ??? ??? ??? ?if (Throwable.class.isAssignableFrom(paramType)) {
?? ??? ??? ??? ??? ?result.add((Class<? extends Throwable>) paramType);
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ??? ?if (result.isEmpty()) {
?? ??? ??? ?throw new IllegalStateException("No exception types mapped to " + method);
?? ??? ?}
?? ??? ?return result;
?? ?}

了解這個緩存后,再回過頭來看解析異常獲取對應(yīng)方法,其實(shí)就是從緩存中找而已。

?? ?private Method getMappedMethod(Class<? extends Throwable> exceptionType) {
?? ??? ?List<Class<? extends Throwable>> matches = new ArrayList<>();
?? ??? ?for (Class<? extends Throwable> mappedException : this.mappedMethods.keySet()) {
?? ??? ??? ?// 只要出現(xiàn)的異常是指定異常的子類,就算作匹配
?? ??? ??? ?if (mappedException.isAssignableFrom(exceptionType)) {
?? ??? ??? ??? ?matches.add(mappedException);
?? ??? ??? ?}
?? ??? ?}
?? ??? ?if (!matches.isEmpty()) {
?? ??? ??? ?// 有可能出現(xiàn)同一個異常匹配到多個映射的情況,這里按異常層級關(guān)系,從小大大排序
?? ??? ??? ?matches.sort(new ExceptionDepthComparator(exceptionType));
?? ??? ??? ?// 取最小層級的
?? ??? ??? ?return this.mappedMethods.get(matches.get(0));
?? ??? ?}else {
?? ??? ??? ?return null;
?? ??? ?}
?? ?}

以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Java中的clone方法實(shí)例詳解

    Java中的clone方法實(shí)例詳解

    這篇文章主要介紹了Java中的clone方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-01-01
  • SpringBoot項(xiàng)目加載配置文件的6種方式小結(jié)

    SpringBoot項(xiàng)目加載配置文件的6種方式小結(jié)

    這篇文章給大家總結(jié)了六種SpringBoot項(xiàng)目加載配置文件的方式,通過@value注入,通過@ConfigurationProperties注入,通過框架自帶對象Environment實(shí)現(xiàn)屬性動態(tài)注入,通過@PropertySource注解,yml外部文件,Java原生態(tài)方式注入這六種,需要的朋友可以參考下
    2023-09-09
  • 使用Springboot封裝好的發(fā)送post請求的工具類

    使用Springboot封裝好的發(fā)送post請求的工具類

    本文介紹了在Springboot中封裝發(fā)送HTTP請求的工具類,并提供了普通的HTTP請求工具類代碼和Response類的使用示例,這些工具類可為開發(fā)者提供便利性和參考價值,幫助提高開發(fā)效率
    2024-09-09
  • Spring事務(wù)Transaction配置的五種注入方式詳解

    Spring事務(wù)Transaction配置的五種注入方式詳解

    這篇文章主要介紹了Spring事務(wù)Transaction配置的五種注入方式詳解,具有一定的參考價值,感興趣的小伙伴們可以參考一下。
    2017-04-04
  • 了解java中對象基礎(chǔ)Object類

    了解java中對象基礎(chǔ)Object類

    本文主要講解了java中對象基礎(chǔ)Object類,文中運(yùn)用大量代碼講解的非常詳細(xì),想學(xué)習(xí)相關(guān)知識的小伙伴可以參考一下這篇文章
    2021-09-09
  • B/S與C/S架構(gòu)的區(qū)別介紹

    B/S與C/S架構(gòu)的區(qū)別介紹

    本文詳細(xì)講解了B/S與C/S架構(gòu)的區(qū)別,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-12-12
  • SpringBoot微信掃碼支付的實(shí)現(xiàn)示例

    SpringBoot微信掃碼支付的實(shí)現(xiàn)示例

    這篇文章主要介紹了SpringBoot微信掃碼支付的實(shí)現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01
  • SpringBoot中實(shí)現(xiàn)多數(shù)據(jù)源連接和切換的方案

    SpringBoot中實(shí)現(xiàn)多數(shù)據(jù)源連接和切換的方案

    在Spring Boot中,通過AbstractRoutingDataSource實(shí)現(xiàn)多數(shù)據(jù)源連接是一種常見的做法,這種技術(shù)允許你在運(yùn)行時動態(tài)地切換數(shù)據(jù)源,從而支持對多個數(shù)據(jù)庫的操作,本文給大家介紹了SpringBoot中實(shí)現(xiàn)多數(shù)據(jù)源連接和切換的方案,需要的朋友可以參考下
    2024-11-11
  • 使用Springboot整合Apollo配置中心

    使用Springboot整合Apollo配置中心

    這篇文章主要介紹了使用Springboot整合Apollo配置中心的操作,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-07-07
  • 詳解springboot項(xiàng)目啟動時如何排除用不到的bean

    詳解springboot項(xiàng)目啟動時如何排除用不到的bean

    使用springboot開發(fā)項(xiàng)目,我們有時候會排除一些項(xiàng)目里面用不到的bean,不然的話項(xiàng)目啟動會報錯,這種情況通常是發(fā)生在什么場景里呢,以及如何解決呢,今天咱們就聊一聊
    2024-01-01

最新評論

德安县| 祁门县| 通化市| 偃师市| 乌苏市| 姚安县| 介休市| 长丰县| 固镇县| 望谟县| 岐山县| 江达县| 延川县| 湖口县| 林甸县| 中西区| 辽宁省| 永宁县| 镇康县| 靖西县| 临安市| 岳普湖县| 厦门市| 昌平区| 大理市| 东丽区| 夹江县| 隆昌县| 化州市| 龙岩市| 汤阴县| 岫岩| 文登市| 镇坪县| 蒙山县| 金沙县| 阿拉善右旗| 灵武市| 临泽县| 都江堰市| 甘洛县|