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

淺談spring ioc的注入方式及注入不同的數(shù)據(jù)類型

 更新時(shí)間:2017年12月26日 15:17:59   作者:等想出來再取  
這篇文章主要介紹了淺談spring ioc的注入方式及注入不同的數(shù)據(jù)類型,具有一定借鑒價(jià)值,需要的朋友可以參考下

關(guān)于Spring-IoC的簡(jiǎn)單使用參考:

spring ioc的簡(jiǎn)單實(shí)例及bean的作用域?qū)傩越馕?/strong>

1、通過set方法注入不同數(shù)據(jù)類型

測(cè)試類代碼(set方式注入的屬性一定要加set方法)

/**通過set方法注入示例*/
public class IoC_By_Set {
	/**注入Integer類型參數(shù)*/
	private Integer id;
	/**注入String類型參數(shù)*/
	private String name;
	/**注入實(shí)體Bean*/
	private User user;
	/**注入數(shù)組*/
	private Object[] array;
	/**注入List集合*/
	private List<Object> list;
	/**注入Set集合*/
	private Set<Object> set;
	/**注入Map鍵值對(duì)*/
	private Map<Object, Object> map;
	/**注入properties類型*/
	private Properties properties;
	/**注入空字符串*/
	private String emptyValue;
	/**注入null值*/
	private String nullValue = "";
	/**檢測(cè)注入的屬性是否全部正確*/
	public Boolean checkAttr() {
		if(id == null) {
			return false;
		} else {
			System.out.println("id:" + id);
		}
		System.out.println("--------------------------");
		if(name == null) {
			return false;
		} else {
			System.out.println("name:" + name);
		}
		System.out.println("--------------------------");
		if(user == null) {
			return false;
		} else {
			System.out.println("Bean:" + user.getId() + "|" + 
			          user.getUserName() + "|" + user.getPassWord());
		}
		System.out.println("--------------------------");
		if(array == null) {
			return false;
		} else {
			System.out.println("array:");
			for (Object object : array) {
				System.out.println(object.toString());
			}
		}
		System.out.println("--------------------------");
		if(list == null) {
			return false;
		} else {
			System.out.println("list:");
			for (Object object : list) {
				System.out.println(object.toString());
			}
		}
		System.out.println("--------------------------");
		if(set == null) {
			return false;
		} else {
			System.out.println("set:");
			for (Object object : set) {
				System.out.println(object.toString());
			}
		}
		System.out.println("--------------------------");
		if(map == null) {
			return false;
		} else {
			Set<Entry<Object, Object>> set = map.entrySet();
			System.out.println("map:");
			for (Entry<Object, Object> entry : set) {
				System.out.println(entry.getKey() + "|" + entry.getValue());
			}
		}
		System.out.println("--------------------------");
		if(properties == null) {
			return false;
		} else {
			Set<Entry<Object, Object>> set = properties.entrySet();
			System.out.println("properties:");
			for (Entry<Object, Object> entry : set) {
				System.out.println(entry.getKey() + "|" + entry.getValue());
			}
		}
		System.out.println("--------------------------");
		if(!"".equals(emptyValue))
		      return false;
		System.out.println("--------------------------");
		if(!(null == nullValue))
		      return false;
		System.out.println("--------------------------");
		System.out.println("全部正確!?。?);
		return true;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public void setArray(Object[] array) {
		this.array = array;
	}
	public void setList(List<Object> list) {
		this.list = list;
	}
	public void setSet(Set<Object> set) {
		this.set = set;
	}
	public void setMap(Map<Object, Object> map) {
		this.map = map;
	}
	public void setProperties(Properties properties) {
		this.properties = properties;
	}
	public void setEmptyValue(String emptyValue) {
		this.emptyValue = emptyValue;
	}
	public void setNullValue(String nullValue) {
		this.nullValue = nullValue;
	}
}

applicationContext.xml配置

  <!-- set方式注入 -->
  <bean id="ioC_By_Set" class="com.bc.ioc.demo01.IoC_By_Set">
    <!-- 注入id屬性 -->
    <property name="id" value="1"/>
    <!-- 使用<![CDATA[]]>標(biāo)記處理XML特 殊字符 -->
    <property name="name">
      <!-- 也可以使用P&amp;G -->
      <value><![CDATA[P&G]]></value>
    </property>
    <!-- 定義內(nèi)部Bean注入 -->
    <property name="user">
      <bean class="com.bc.pojo.User">
        <property name="id" value="1"/>
        <property name="userName" value="內(nèi)部Bean"/>
        <property name="passWord" value="233"/>
      </bean>
    </property>
    <!-- 注入數(shù)組類型 -->
    <property name="array">
      <array>
        <!-- 定義數(shù)組元素 -->
        <value>array01</value>
        <value>array02</value>
        <value>array03</value>
      </array>
    </property>
    <!-- 注入List類型 -->
    <property name="list">
      <list>
        <!-- 定義list中元素 -->
        <value>list01</value>
        <value>list02</value>
        <value>list03</value>
      </list>
    </property>
    <!-- 注入Set類型 -->
    <property name="set">
      <set>
        <!-- 定義set中元素 -->
        <value>set01</value>
        <value>set02</value>
        <value>set03</value>
      </set>
    </property>
    <!-- 注入Map類型 -->
    <property name="map">
      <map>
        <!-- 定義map中的鍵值對(duì) -->
        <entry>
          <key>
            <value>mapKey01</value>
          </key>
          <value>mapValue01</value>
        </entry>
        <entry>
          <key>
            <value>mapKey02</value>
          </key>
          <value>mapValue02</value>
        </entry>
      </map>
    </property>
    <!-- 注入properties類型 -->
    <property name="properties">
      <props>
        <!-- 定義properties中的鍵值對(duì) -->
        <prop key="propKey1">propValue1</prop>
        <prop key="propKey2">propValue2</prop>
      </props>
    </property>
    <!-- 注入空字符串 -->
    <property name="emptyValue">
      <value></value>
    </property>
    <!-- 注入null值 -->
    <property name="nullValue">
      <null/>
    </property>
  </bean>

測(cè)試代碼

public class IoC_Test {
	private ApplicationContext ctx;
	@Before
	  public void load() {
		//讀取applicationContext.xml配置文件
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
	}
	@Test
	  public void SetTest() {
		IoC_By_Set ioc = (IoC_By_Set) ctx.getBean("ioC_By_Set");
		ioc.checkAttr();
	}
}

控制臺(tái)結(jié)果:

id:1
--------------------------
name:P&G
--------------------------
Bean:1|內(nèi)部Bean|233
--------------------------
array:
array01
array02
array03
--------------------------
list:
list01
list02
list03
--------------------------
set:
set01
set02
set03
--------------------------
map:
mapKey01|mapValue01
mapKey02|mapValue02
--------------------------
properties:
propKey2|propValue2
propKey1|propValue1
--------------------------
--------------------------
--------------------------
全部正確?。?!

2、通過構(gòu)造方法注入各種類型屬性

注意:使用JDK1.8版本請(qǐng)將spring相關(guān)jar包升級(jí)到4.x版本以上,否則不兼容構(gòu)造方法注入

測(cè)試類代碼

/** 通過構(gòu)造方法注入示例 */
public class IoC_By_Constructor {
	private Integer id;
	private String name;
	private User user;
	private List<Object> list;
	public IoC_By_Constructor() {
	}
	public IoC_By_Constructor(Integer id, String name, User user,
	      List<Object> list) {
		this.id = id;
		this.name = name;
		this.user = user;
		this.list = list;
	}
	/**檢查是否注入成功*/
	public Boolean checkAttr() {
		if(id == null) {
			return false;
		} else {
			System.out.println("id:" + id);
		}
		System.out.println("----------------------------");
		if(name == null) {
			return false;
		} else {
			System.out.println("name:" + name);
		}
		System.out.println("----------------------------");
		if(user == null) {
			return false;
		} else {
			System.out.println("user:" + user.getId() + "|" + 
			          user.getUserName() + "|" + user.getPassWord());
		}
		System.out.println("----------------------------");
		if(list == null) {
			return false;
		} else {
			System.out.println("list:");
			for (Object object : list) {
				System.out.println(object.toString());
			}
		}
		System.out.println("----------------------------");
		System.out.println("全部正確?。?!");
		return true;
	}
}

applicationContext.xml配置

  <!-- 構(gòu)造方法注入 演示幾種類型-->
  <bean id="ioC_By_Constructor" class="com.bc.ioc.demo02.IoC_By_Constructor">
    <!-- 注入Integer屬性,可以選擇使用index指定參數(shù)位置,也可以選擇使用type指定參數(shù)類型 -->
    <constructor-arg index="0" value="1" type="java.lang.Integer"/>
    <!-- 注入字符串 -->
    <constructor-arg value="P&amp;G"/>
    <!-- 注入對(duì)象 -->
    <constructor-arg>
      <!-- 內(nèi)建對(duì)象 -->
      <bean class="com.bc.pojo.User">
        <constructor-arg value="1"/>
        <constructor-arg value="構(gòu)造內(nèi)部Bean"/>
        <constructor-arg value="666"/>
      </bean>
    </constructor-arg>
    <!-- 注入集合 -->
    <constructor-arg>
      <list>
        <value>list01</value>
        <value>list02</value>
        <value>list03</value>
      </list>
    </constructor-arg>
  </bean>

測(cè)試代碼:

public class IoC_Test {
	private ApplicationContext ctx;
	@Before
	  public void load() {
		//讀取applicationContext.xml配置文件
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
	}
	@Test
	  public void constructorTest() {
		IoC_By_Constructor ioc = (IoC_By_Constructor) ctx.getBean("ioC_By_Constructor");
		ioc.checkAttr();
	}
}

控制臺(tái)結(jié)果:

id:1
----------------------------
name:P&G
----------------------------
user:1|構(gòu)造內(nèi)部Bean|666
----------------------------
list:
list01
list02
list03
----------------------------
全部正確!?。?/pre>

3、自動(dòng)注入(自動(dòng)裝配)

自動(dòng)裝配雖然能節(jié)省一些代碼但是不推薦使用

測(cè)試類代碼:

/**自動(dòng)裝配注入*/
public class IoC_By_Auto {
	private User user;
	/**檢查是否注入成功*/
	public Boolean checkAttr() {
		if(user == null) {
			return false;
		} else {
			System.out.println("user:" + user.getId() + "|" + 
			          user.getUserName() + "|" + user.getPassWord());
		}
		System.out.println("正確?。?!");
		return true;
	}
	/**自動(dòng)裝配的屬性需要設(shè)置set方法*/
	public void setUser(User user) {
		this.user = user;
	}
}

applicationContext.xml配置

  <!-- 被自動(dòng)裝配獲取的bean -->
  <bean id="user" class="com.bc.pojo.User">
    <property name="id" value="1"/>
    <property name="userName" value="自動(dòng)裝配"/>
    <property name="passWord" value="233"/>
  </bean>
  <!-- 自動(dòng)裝配的bean
     autowire:byName 根據(jù)類的屬性名查找與之命名相同的id的bean進(jìn)行裝配
         byType 根據(jù)類的屬性類型查找唯一一個(gè)匹配類型的bean,如果有多個(gè)bean匹配則拋出異常
         constructor 根據(jù)類的構(gòu)造方法參數(shù)類型匹配對(duì)應(yīng)的bean
         no 默認(rèn),表示不使用自動(dòng)裝配
         default:由上級(jí)標(biāo)簽<beans>的default-autowire屬性確定 -->
  <bean id="ioC_By_Auto" class="com.bc.ioc.demo03.IoC_By_Auto" autowire="byName"></bean>

測(cè)試代碼

public class IoC_Test {
	private ApplicationContext ctx;
	@Before
	  public void load() {
		//讀取applicationContext.xml配置文件
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
	}
	@Test
	  public void AutoTest() {
		IoC_By_Auto ioc = (IoC_By_Auto) ctx.getBean("ioC_By_Auto");
		ioc.checkAttr();
	}
}

控制臺(tái)結(jié)果

user:1|自動(dòng)裝配|233
正確?。?!

以上使用的是byName模式,其他模式配置代碼已經(jīng)注明,不做測(cè)試。

4、使用P命名空間注入屬性

測(cè)試類代碼

/**使用P命名空間注入*/
public class IoC_By_P {
	private Integer id;
	private String name;
	private User user;
	/**檢查是否注入成功*/
	public Boolean checkAttr() {
		if(id == null) {
			return false;
		} else {
			System.out.println("id:" + id);
		}
		System.out.println("----------------------------");
		if(name == null) {
			return false;
		} else {
			System.out.println("name:" + name);
		}
		System.out.println("----------------------------");
		if(user == null) {
			return false;
		} else {
			System.out.println("user:" + user.getId() + "|" + 
			          user.getUserName() + "|" + user.getPassWord());
		}
		System.out.println("----------------------------");
		System.out.println("全部正確?。?!");
		return true;
	}
	//使用P命名空間注入屬性需要設(shè)置set方法
	public void setId(Integer id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setUser(User user) {
		this.user = user;
	}
}

applicationContext.xml配置

  <!-- 使用P命名空間注入各種類型屬性 -->
  <bean id="user2" class="com.bc.pojo.User">
    <property name="id" value="1"/>
    <property name="userName" value="P"/>
    <property name="passWord" value="233"/>
  </bean>
  <bean id="ioC_By_P" class="com.bc.ioc.demo04.IoC_By_P" p:id="1" 
    p:name="命名空間" p:user-ref="user2"></bean>

測(cè)試代碼

public class IoC_Test {
	private ApplicationContext ctx;
	@Before
	  public void load() {
		//讀取applicationContext.xml配置文件
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
	}
	@Test
	  public void PTest() {
		IoC_By_P ioc = (IoC_By_P) ctx.getBean("ioC_By_P");
		ioc.checkAttr();
	}
}

控制臺(tái)結(jié)果

id:1
----------------------------
name:命名空間
----------------------------
user:1|P|233
----------------------------
全部正確?。。?/pre>

5、使用注解方式注入

Spring在3.0以后,提供了基于Annotation(注解)的注入。

1.@Autowired-對(duì)成員變量、方法和構(gòu)造函數(shù)進(jìn)行標(biāo)注,來完成自動(dòng)裝配的工作,不推薦使用

2.@Qualifier-配合@Autowired來解決裝配多個(gè)同類型的bean

3.@Resource-JSR-250標(biāo)準(zhǔn)注解,作用相當(dāng)于@Autowired,只不過@Autowired按byType自動(dòng)注入,而@Resource默認(rèn)按byName自動(dòng)注入

4.@PostConstruct-在方法上加上注解@PostConstruct,這個(gè)方法就會(huì)在Bean初始化之后被Spring容器執(zhí)行

5.@PreDestroy-在方法上加上注解@PreDestroy,這個(gè)方法就會(huì)在Bean初始化之后被Spring容器執(zhí)行

6.@Component-只需要在對(duì)應(yīng)的類上加上一個(gè)@Component注解,就將該類定義為一個(gè)Bean,不推薦使用,推薦使用更加細(xì)化的三種:@Repository、@Service、@Controller

@Repository存儲(chǔ)層Bean

@Service業(yè)務(wù)層Bean

@Controller展示層Bean

7.@Scope-定義Bean的作用范圍

首先配置applicationContext.xml開啟注解

  <!-- 掃描包中注解標(biāo)注的類 -->
  <context:component-scan base-package="com.bc.ioc.demo05"/>

實(shí)體Bean加注解

@Repository
public class User {
	private Integer id = 1;
	private String userName = "注解注入";
	private String passWord = "233";
	public User() {
		super();
	}
	public User(Integer id, String userName, String passWord) {
		super();
		this.id = id;
		this.userName = userName;
		this.passWord = passWord;
	}
	public Integer getId() {
		return id;
	}
	public String getUserName() {
		return userName;
	}
	public String getPassWord() {
		return passWord;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
}

測(cè)試類代碼加注解

/**使用注解注入屬性*/
@Service("ioC_By_Annotation")
public class IoC_By_Annotation {
	@Resource
	  private User user;
	public void setUser(User user) {
		this.user = user;
	}
	/**檢查是否注入成功*/
	public Boolean checkAttr() {
		if(user == null) {
			return false;
		} else {
			System.out.println("user:" + user.getId() + "|" + 
			          user.getUserName() + "|" + user.getPassWord());
		}
		System.out.println("正確!?。?);
		return true;
	}
}

測(cè)試代碼

public class IoC_Test {
	private ApplicationContext ctx;
	@Before
	  public void load() {
		//讀取applicationContext.xml配置文件
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
	}
	@Test
	  public void annotationTest() {
		IoC_By_Annotation ioc = (IoC_By_Annotation) ctx.getBean("ioC_By_Annotation");
		ioc.checkAttr();
	}
}

控制臺(tái)輸出

經(jīng)測(cè)試使用注解注入如果applicationContext.xml配置有其他注入方式會(huì)報(bào)錯(cuò),也會(huì)導(dǎo)致其他注入方式異常。

user:1|注解注入|233
正確?。?!

6、通過配置靜態(tài)工廠方法Bean注入

靜態(tài)工廠代碼

/**靜態(tài)工廠*/
public class StaticFactory {
	public static Integer getId() {
		return 1;
	}
	public static String getName() {
		return "靜態(tài)工廠";
	}
	public static User getUser() {
		return new User(1, "工廠User", "666");
	}
}

測(cè)試類代碼

/** 通過靜態(tài)工廠方式注入 */
public class IoC_By_StaticFactory {
	private Integer id;
	private String name;
	private User user;
	/** 檢查是否注入成功 */
	public Boolean checkAttr() {
		if (id == null) {
			return false;
		} else {
			System.out.println("id:" + id);
		}
		System.out.println("----------------------------");
		if (name == null) {
			return false;
		} else {
			System.out.println("name:" + name);
		}
		System.out.println("----------------------------");
		if (user == null) {
			return false;
		} else {
			System.out.println("user:" + user.getId() + "|"
			          + user.getUserName() + "|" + user.getPassWord());
		}
		System.out.println("----------------------------");
		System.out.println("全部正確?。。?);
		return true;
	}
	/**需要為需要注入的屬性設(shè)置set方法*/
	public void setId(Integer id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setUser(User user) {
		this.user = user;
	}
}

applicationContext.xml配置

  <!-- 配置靜態(tài)工廠方法Bean 其實(shí)就是將工廠方法返回的數(shù)值配置成Bean -->
  <bean id="factory_id" class="com.bc.ioc.demo06.StaticFactory" factory-method="getId"/>
  <bean id="factory_name" class="com.bc.ioc.demo06.StaticFactory" factory-method="getName"/>
  <bean id="factory_user" class="com.bc.ioc.demo06.StaticFactory" factory-method="getUser"/>
  <!-- 注入對(duì)應(yīng)的靜態(tài)工廠方法Bean -->
  <bean id="ioC_By_StaticFactory" class="com.bc.ioc.demo06.IoC_By_StaticFactory">
    <property name="id" ref="factory_id"/>
    <property name="name" ref="factory_name"/>
    <property name="user" ref="factory_user"/>
  </bean>

測(cè)試代碼

public class IoC_Test {
	private ApplicationContext ctx;
	@Before
	  public void load() {
		//讀取applicationContext.xml配置文件
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
	}
	@Test
	  public void staticFactoryTest() {
		IoC_By_StaticFactory ioc = (IoC_By_StaticFactory) ctx.getBean("ioC_By_StaticFactory");
		ioc.checkAttr();
	}
}

控制臺(tái)輸出結(jié)果

id:1
----------------------------
name:靜態(tài)工廠
----------------------------
user:1|工廠User|666
----------------------------
全部正確?。。?/pre>

7、通過實(shí)例工廠方法注入

與靜態(tài)工廠區(qū)別在于實(shí)例工廠不是靜態(tài)的,需要先new 一個(gè)實(shí)例工廠對(duì)象,才可以配置其方法,而new 的這個(gè)對(duì)象也由spring來管理

工廠代碼

/**實(shí)例工廠*/
public class Factory {
	public Integer getId() {
		return 1;
	}
	public String getName() {
		return "實(shí)例工廠";
	}
	public User getUser() {
		return new User(1, "實(shí)例工廠User", "233");
	}
}

測(cè)試類代碼

/**實(shí)例工廠注入*/
public class IoC_By_Factory {
	private Integer id;
	private String name;
	private User user;
	/** 檢查是否注入成功 */
	public Boolean checkAttr() {
		if (id == null) {
			return false;
		} else {
			System.out.println("id:" + id);
		}
		System.out.println("----------------------------");
		if (name == null) {
			return false;
		} else {
			System.out.println("name:" + name);
		}
		System.out.println("----------------------------");
		if (user == null) {
			return false;
		} else {
			System.out.println("user:" + user.getId() + "|"
			          + user.getUserName() + "|" + user.getPassWord());
		}
		System.out.println("----------------------------");
		System.out.println("全部正確!??!");
		return true;
	}
	/**需要為需要注入的屬性設(shè)置set方法*/
	public void setId(Integer id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setUser(User user) {
		this.user = user;
	}
}

applicationContext.xml配置

  <!-- 配置實(shí)例工廠Bean -->
  <bean id="factory" class="com.bc.ioc.demo07.Factory"/>
  <!-- 配置實(shí)例工廠方法Bean -->
  <bean id="f_id" factory-bean="factory" factory-method="getId"/>
  <bean id="f_name" factory-bean="factory" factory-method="getName"/>
  <bean id="f_user" factory-bean="factory" factory-method="getUser"/>
  <!-- 注入對(duì)應(yīng)的實(shí)例工廠方法Bean -->
  <bean id="ioC_By_Factory" class="com.bc.ioc.demo07.IoC_By_Factory">
    <property name="id" ref="f_id"/>
    <property name="name" ref="f_name"/>
    <property name="user" ref="f_user"/>
  </bean>

測(cè)試類代碼

public class IoC_Test {
	private ApplicationContext ctx;
	@Before
	  public void load() {
		//讀取applicationContext.xml配置文件
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
	}
	@Test
	  public void factoryTest() {
		IoC_By_Factory ioc = (IoC_By_Factory) ctx.getBean("ioC_By_Factory");
		ioc.checkAttr();
	}
}

控制臺(tái)輸出

id:1
----------------------------
name:實(shí)例工廠
----------------------------
user:1|實(shí)例工廠User|233
----------------------------
全部正確?。。?/pre>

總結(jié)

以上就是本文關(guān)于淺談spring ioc的注入方式及注入不同的數(shù)據(jù)類型的全部?jī)?nèi)容,希望對(duì)大家有所幫助。感興趣的朋友可以繼續(xù)參閱本站其他相關(guān)專題,如有不足之處,歡迎留言指出。感謝朋友們對(duì)本站的支持!

相關(guān)文章

  • Java面試題之MD5加密的安全性詳解

    Java面試題之MD5加密的安全性詳解

    MD5 是 Message Digest Algorithm 的縮寫,譯為信息摘要算法,它是 Java 語言中使用很廣泛的一種加密算法。本文將通過示例討論下MD5的安全性,感興趣的可以了解一下
    2022-10-10
  • Java Web Listener實(shí)現(xiàn)事件監(jiān)聽與處理

    Java Web Listener實(shí)現(xiàn)事件監(jiān)聽與處理

    Java Web開發(fā)中的Listener是一種事件機(jī)制,通過監(jiān)聽Web應(yīng)用程序的事件,實(shí)現(xiàn)對(duì)事件的處理,從而實(shí)現(xiàn)更加靈活和高效的應(yīng)用程序開發(fā)。Listener能夠監(jiān)聽的事件包括應(yīng)用程序啟動(dòng)和關(guān)閉、Session創(chuàng)建和銷毀、請(qǐng)求和響應(yīng)對(duì)象的創(chuàng)建和銷毀等
    2023-04-04
  • 記錄一次connection reset 錯(cuò)誤的解決全過程

    記錄一次connection reset 錯(cuò)誤的解決全過程

    這篇文章主要介紹了記錄一次connection reset 錯(cuò)誤的解決全過程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-04-04
  • Java實(shí)現(xiàn)雪花算法的工具類介紹

    Java實(shí)現(xiàn)雪花算法的工具類介紹

    雪花 (SnowFlake )算法是一種分布式唯一ID生成算法,可以生成全局唯一的ID標(biāo)識(shí)符,就像自然界中雪花一般沒有相同的雪花,本文和大家分享了一個(gè)雪花算法工具類,需要的可以收藏一下
    2023-05-05
  • SpringBoot訪問接口自動(dòng)跳轉(zhuǎn)login頁面的問題及解決

    SpringBoot訪問接口自動(dòng)跳轉(zhuǎn)login頁面的問題及解決

    這篇文章主要介紹了SpringBoot訪問接口自動(dòng)跳轉(zhuǎn)login頁面的問題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • 詳解Java中的reactive stream協(xié)議

    詳解Java中的reactive stream協(xié)議

    Stream大家應(yīng)該都很熟悉了,java8中為所有的集合類都引入了Stream的概念。優(yōu)雅的鏈?zhǔn)讲僮?,流式處理邏輯,相信用過的人都會(huì)愛不釋手。本文將詳細(xì)介紹Java中的reactive stream協(xié)議。
    2021-06-06
  • jackson在springboot中的使用方式-自定義參數(shù)轉(zhuǎn)換器

    jackson在springboot中的使用方式-自定義參數(shù)轉(zhuǎn)換器

    這篇文章主要介紹了jackson在springboot中的使用方式-自定義參數(shù)轉(zhuǎn)換器,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-10-10
  • Java數(shù)據(jù)結(jié)構(gòu)-HashMap詳解

    Java數(shù)據(jù)結(jié)構(gòu)-HashMap詳解

    這篇文章主要介紹了Java數(shù)據(jù)結(jié)構(gòu)-HashMap,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-03-03
  • IDEA標(biāo)簽tabs多行顯示的設(shè)置

    IDEA標(biāo)簽tabs多行顯示的設(shè)置

    這篇文章主要介紹了IDEA標(biāo)簽tabs多行顯示的設(shè)置方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2021-02-02
  • SpringMvc中容器加載的過程源碼詳解

    SpringMvc中容器加載的過程源碼詳解

    這篇文章主要介紹了SpringMvc中容器加載的過程源碼詳解,springmvc是基于spring的一個(gè)web層框架,同樣也是web層框架的有struts,struts2等等,但是struts因?yàn)槁┒吹葐栴},被慢慢淘汰了,現(xiàn)在基本都在用springmvc,需要的朋友可以參考下
    2023-11-11

最新評(píng)論

新余市| 库车县| 靖西县| 普兰店市| 巫山县| 高尔夫| 商都县| 湖口县| 胶州市| 崇义县| 济宁市| 延津县| 南城县| 昆山市| 开鲁县| 方山县| 巩留县| 峨眉山市| 乐陵市| 杭州市| 交城县| 天祝| 彰化市| 左权县| 长治市| 禄丰县| 扎囊县| 衡山县| 南皮县| 日喀则市| 武城县| 康乐县| 麦盖提县| 辛集市| 威远县| 句容市| 兴仁县| 东宁县| 玉林市| 新竹市| 永新县|