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的时候,编译器会报错
	}

}

在这里插入图片描述

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