Spring常用的一些方法

靜態方法調用

	<bean id="syncConfigIdStatic" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
		<property name="staticMethod" value="com.yang.async.domain.config.DataSyncConfig.setSyncConfigId"/>
		<property name="arguments" value="${dataSyncConfig.syncConfigId}">
		</property>
	</bean>

順序

InitSequenceBean constructor 
InitSequenceBean set properties 
InitSequenceBean postConstruct 
InitSequenceBean afterPropertiesSet 
InitSequenceBean initMethod

認證cation和授權zation

桌面應用程序也通過HTTP協議跟Web服務器交互, 桌面應用程序一般不會使用cookie, 而是把 "用戶名+冒號+密碼"用BASE64編碼的字符串放在http request 中的header Authorization中發送給服務端, 這種方式叫HTTP基本認證(Basic Authentication)

OAuth 對於Http來說,就是放在Authorization header中的不是用戶名密碼, 而是一個token.

除了基本認證(Basic Authentication), 還有摘要認證 digest authentication, WSSE(WS-Security)認證

Authentication :認證
Authorization :授權

authentication 認證訪問者是誰 ;openID;username
authorization 訪問權限

JS

.prop('checked') //返回true/false
$('').prop("checked", true) //賦值

賦值checked幾種寫法

//勾選一個全勾選
function check(id,check) {        
 
    if (check) {                
 
        $("." + id).find("input[type='checkbox']").prop("checked", true);        
 
    } else {                
 
        $("." + id).find("input[type='checkbox']").prop("checked", false);        
 
    }

$("#chk1").find('input:checkbox').each(function() { //遍歷所有複選框
 
    if ($(this).prop('checked') == true) {
 
        console.log($(this).val()); //打印當前選中的複選框的值
 
    }
 

attribute表示HTML文檔節點的屬性,property表示JS對象的屬性。

// 相當於 msg.getAttribute("data_id");
var dataId = $msg.attr("data_id"); // 145

// prop()依賴的是JS原生的 element[property] 和 element[property] = value; 
// 相當於 msg["pid"] = "pid值";
$msg.prop("pid", "pid值");

編碼、

public class Main {

	public static void main(String[] args) {
		//4E00-9FA5是基本漢字,只佔一個字符,也就是一個char,也就是2字節,也就是16位
		String s = "一";//Unicode編碼:4E00
		String s1 = "龥";//Unicode編碼:9FA5
		//?是漢字擴展字符,佔兩個字符,也就是兩個char,也就是4字節,也就是32位
		String s2 = "?";//Unicode編碼:20000
		System.err.println("測試字符s:" + s);
		System.err.println("測試字符s2:" + s2);
		System.err.println("測試字符s長度:" +s.length());
		System.err.println("測試字符s2長度:" +s2.length());
		System.out.println("s轉爲二進制:" + Integer.toBinaryString(s.charAt(0)));
		System.out.println("s2轉爲二進制:" + Integer.toBinaryString(s2.charAt(0)) + "-" + Integer.toBinaryString(s2.charAt(1)));
		
		//char c='?';//當我們設置一個佔多字符的漢字給char的時候,編譯器會報錯
	}

}

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章