springboot工具類

ClassPathResource 在類路徑下讀取資源

public final String getPath()
public boolean exists()
public InputStream getInputStream()

WebUtils 獲取web資源工具類

public static String getRealPath(ServletContext servletContext, String path)
public static Object getSessionAttribute(HttpServletRequest request, String name)
public static File getTempDir(ServletContext servletContext)

ServletRequestUtils 提供獲取請求參數 并自動類型轉換的功能

public static Integer getIntParameter(ServletRequest request, String name)
public static int[] getIntParameters(ServletRequest request, String name)
public static Long getLongParameter(ServletRequest request, String name)

StringUtils 提供對字符串操作的工具類
public static String[] split(String toSplit, String delimiter)
public static String collectionToCommaDelimitedString(Collection<?> coll)
public static boolean hasLength(String str)

SerializationUtils 提供序列化與反序列化
public static byte[] serialize(Object object)
public static Object deserialize(byte[] bytes)

FactoryBean 通過實現該接口可以將我們自定義的Bean注入到Spring的容器當中去
public interface FactoryBean {
T getObject() throws Exception;
Class<?> getObjectType();
boolean isSingleton();
}

ApplicationContextAware 實現這個接口可以將 ApplicationContext 注入進來
public interface ApplicationContextAware extends Aware {
void setApplicationContext(ApplicationContext applicationContext) throws BeansException;
}

InitializingBean 實現該接口可以做一些初始化動作,afterPropertiesSet方法會在容器初始化后被自動調用
public interface InitializingBean {
void afterPropertiesSet() throws Exception;
}

DisposableBean 實現該接口可以再Spring容器銷毀時調用,可以在這個方法中做一些比如清理資源的動作
public interface DisposableBean {
void destroy() throws Exception;
}

BeanNameAware 實現該接口,Spring容器在啟動后會把當前Bean的名字注入進來
public interface BeanNameAware extends Aware {
void setBeanName(String name);
}

ResourceLoaderAware 實現該接口可以注入ResourceLoader對象,通過它可以很方便的加載一些系統資源
public interface ResourceLoaderAware extends Aware {
void setResourceLoader(ResourceLoader resourceLoader);
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/249969.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/249969.shtml
英文地址,請注明出處:http://en.pswp.cn/news/249969.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

MySQL中事物的詳解

1. 事物的定義及特性 事務是一組操作數據庫的SQL語句組成的工作單元&#xff0c;該工作單元中所有操作要么同時成功&#xff0c;要么同時失敗。事物有如下四個特性&#xff0c;ACID簡稱“酸性”。 1&#xff09;原子性&#xff1a;工作單元中所有的操作要么都成功&#xff0c;要…

記了老是忘記那就寫下來吧宏任務微任務

宏任務&#xff1a;script 定時器 微任務&#xff1a;promiss process.nexttick new Promise(function(resolve){console.log(3);//此為同步程序resolve();//同步 是否異步 由內部函數決定console.log(4); }).then(function(){ //。then 異步console.log(5); });async function…

SPRING自定義注入CONTROLLER變量

問題描述 在SpringMVC中默認可以注入Model&#xff0c;ModelAndView&#xff0c;RequestParam&#xff0c;PathVariable 等&#xff0c;那么這個是怎么實現的&#xff0c;以及怎么注入一個自定義的參數呢 HandlerMethodArgumentResolver 在SpringMVC中有一個接口HandlerMethod…

進程,線程

import os, timeif __name__ __main__:print(the calling process id:%d % os.getpid())# 創建進程pid os.fork()if pid 0:# 子進程print(the child pid is %d % os.getpid())time.sleep(3)elif pid > 0:# 父進程os.wait() # 等待子進程終止print([%d]bye-bye % os.getpi…

livebos--iframe使用

新建一個方法。建一個參數&#xff0c;iframe控件&#xff0c;虛擬列。然后使用以下信息 <% livebos languagejavascript %>var url LB_ObjURI("Lb_lbOrganization",0,[],["NoTitle"]);var v {"edit" : "url ", "view"…

單行溢出 和多行溢出

/*單行溢出*/.one_txt_cut{overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}.txt_cut{overflow : hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;}轉載于:https://www.cnblogs.com/smzd/p/8491583…

Spring方法注入 @Lookup注解使用

情景分析 在Spring的諸多應用場景中bean都是單例形式&#xff0c;當一個單利bean需要和一個非單利bean組合使用或者一個非單利bean和另一個非單利bean組合使用時&#xff0c;我們通常都是將依賴以屬性的方式放到bean中來引用&#xff0c;然后以Autowired來標記需要注入的屬性。…

Jupyter配置步驟

Jupyter是基于瀏覽器的可交互式開發工具&#xff0c;在數據科學界非常受歡迎&#xff0c;它功能齊全&#xff0c;使用方便&#xff0c;是一款數據分析和建模挖掘的利器。 本文簡介Jupyter的配置和使用過程 一、修改添加國內鏡像 通常我會先安裝Anaconda&#xff0c;再安裝Jupyt…

edittext 屬性

1.去掉edittext的底線&#xff0c;設置&#xff0c;不管是edittext&#xff0c;還是appcompatEdittext都是這個屬性 轉載于:https://www.cnblogs.com/hechangshou/p/9301004.html

定義高亮顏色

/*怎么定義高亮的顏色*/-webkit-tap-highlight-color: transparent;/*透明 其實就是不顯示顏色*/-webkit-tap-highlight-color: red; 轉載于:https://www.cnblogs.com/smzd/p/8491587.html

springboot 配置webservice接口

導入依賴的jar <!-- webservice cxf --><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-frontend-jaxws</artifactId><version>3.1.6</version></dependency><dependency><groupId>org…

【Django】認證系統

目錄 #. auth模塊1. 認證 authenticate()2. 登陸 login(HttpRequest, user)3. 注銷 logout(request)4. 認證判斷 is_authenticated()5. 登陸校驗 login_requierd()6. 創建普通用戶 create_user()7. 創建超級用戶 create_superuser()8. 密碼校驗 check_password(password)9. 修改…

學習的目的是什么?

學習的目的是為了掌握生存的常識和技能&#xff0c;以便獨立地面對世界&#xff1b; 學習的目的是為了遵從生活的規范和律則&#xff0c;以便和諧地與人相處&#xff1b; 學習的目的是為了探索生命的價值和意義&#xff0c;以便有尊嚴地立于天地之間。 你覺得為什么要學習呢&am…

span里面插入文字

.text-box span::before{ content:attr(data-text);} 轉載于:https://www.cnblogs.com/smzd/p/8491664.html

Spring Boot 動態注入的兩種方式

通過Profilespring.profiles.active spring.profiles.active&#xff1a;官方解釋是激活不同環境下的配置文件&#xff0c;但是實際測試發現沒有對應的配置文件也是可以正常執行的。那就可以把這個key當作一個參數來使用 Profile&#xff1a;spring.profiles.active中激活某配…

kernel devel 安裝與卸載

1、查看系統內核 uname -r 2、查看已安裝kernel-devel uname -a ; rpm -qa kernel\* | sort 3、下載對應的rpm wget xxx/kernel-devel-2.6.32-754.el6.x86_64.rpm 或者 $ sudo yum install "kernel-devel-uname-r $(uname -r)" 4、卸載已安裝的內核 yum remove ker…

彈性布局

/* 開啟彈性布局的換行 */ flex-wrap: wrap;/* 變為多行了 無法使用 align-items 進行位置設置 align-content 在多行的時候 設置屬性 跟 justify-content 一模一樣如果只有 一行時 無法生效 *//* 調整元素 在主軸上的 排布方式flex-end 到主軸的末尾flex-start 默認值center…

詳解 vue-cli 的打包配置文件代碼(給大家寫寫注釋)

一、前言 對于webpack基礎不好&#xff0c;node指令不通的童鞋。估計對自己搭建Vue、react腳手架是相當頭疼的&#xff0c;有種無從下手的感覺。然而&#xff0c;從頭看這2塊&#xff0c;耗時太長&#xff0c;而且說實話得練才行&#xff0c;不練練手看不明白。那大多數人就采取…

AutoFac自動注入時報錯

錯誤描述&#xff1a;An error occurred during the activation of a particular registration 解決辦法&#xff1a;看到了particular這個單詞&#xff0c;用我蹩腳的英語&#xff0c;估計是部分類&#xff1f;結合報錯的兩個類存在互相引用&#xff0c;這就明白了&#xff0c…

嘗試修改源碼需要用到git存一下

git reflog查看本地記錄 git reset --hard 02a3260 轉載于:https://www.cnblogs.com/smzd/p/8492065.html