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

詳解Java的Spring框架中的注解的用法

 更新時(shí)間:2015年11月26日 12:05:08   作者:王小明123  
這篇文章主要介紹了Java的Spring框架中的注解的用法,包括對(duì)Java bean的定義的作用介紹,需要的朋友可以參考下

1. 使用Spring注解來注入屬性

1.1. 使用注解以前我們是怎樣注入屬性的
類的實(shí)現(xiàn):

class UserManagerImpl implements UserManager { 
  private UserDao userDao; 
  public void setUserDao(UserDao userDao) { 
    this.userDao = userDao; 
  } 
  ... 
}

配置文件:

<bean id="userManagerImpl" class="com.kedacom.spring.annotation.service.UserManagerImpl"> 
  <property name="userDao" ref="userDao" /> 
</bean> 
<bean id="userDao" class="com.kedacom.spring.annotation.persistence.UserDaoImpl"> 
  <property name="sessionFactory" ref="mySessionFactory" /> 
</bean>

1.2. 引入@Autowired注解(不推薦使用,建議使用@Resource)
類的實(shí)現(xiàn)(對(duì)成員變量進(jìn)行標(biāo)注)

public class UserManagerImpl implements UserManager { 
  @Autowired 
  private UserDao userDao; 
  ... 
}

或者(對(duì)方法進(jìn)行標(biāo)注)

UserManagerImpl implements UserManager { 
  private UserDao userDao; 
  @Autowired 
  public void setUserDao(UserDao userDao) { 
    this.userDao = userDao; 
  } 
  ... 
}

配置文件

<bean id="userManagerImpl" class="com.kedacom.spring.annotation.service.UserManagerImpl" /> 
<bean id="userDao" class="com.kedacom.spring.annotation.persistence.UserDaoImpl"> 
  <property name="sessionFactory" ref="mySessionFactory" /> 
</bean>

@Autowired可以對(duì)成員變量、方法和構(gòu)造函數(shù)進(jìn)行標(biāo)注,來完成自動(dòng)裝配的工作。以上兩種不同實(shí)現(xiàn)方式中,@Autowired的標(biāo)注位置不同,它們都會(huì)在Spring在初始化userManagerImpl這個(gè)bean時(shí),自動(dòng)裝配userDao這個(gè)屬性,區(qū)別是:第一種實(shí)現(xiàn)中,Spring會(huì)直接將UserDao類型的唯一一個(gè)bean賦值給userDao這個(gè)成員變量;第二種實(shí)現(xiàn)中,Spring會(huì)調(diào)用setUserDao方法來將UserDao類型的唯一一個(gè)bean裝配到userDao這個(gè)屬性。

1.3. 讓@Autowired工作起來
要使@Autowired能夠工作,還需要在配置文件中加入以下代碼

class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />

1.4. @Qualifier
@Autowired是根據(jù)類型進(jìn)行自動(dòng)裝配的。在上面的例子中,如果當(dāng)Spring上下文中存在不止一個(gè)UserDao類型的bean時(shí),就會(huì)拋出BeanCreationException異常;如果Spring上下文中不存在UserDao類型的bean,也會(huì)拋出BeanCreationException異常。我們可以使用@Qualifier配合@Autowired來解決這些問題。
1. 可能存在多個(gè)UserDao實(shí)例

@Autowired 
public void setUserDao(@Qualifier("userDao") UserDao userDao) { 
  this.userDao = userDao; 
}

這樣,Spring會(huì)找到id為userDao的bean進(jìn)行裝配。
2. 可能不存在UserDao實(shí)例

@Autowired(required = false) 
public void setUserDao(UserDao userDao) { 
  this.userDao = userDao; 
} 

1.5. @Resource(JSR-250標(biāo)準(zhǔn)注解,推薦使用它來代替Spring專有的@Autowired注解)
Spring 不但支持自己定義的@Autowired注解,還支持幾個(gè)由JSR-250規(guī)范定義的注解,它們分別是@Resource、@PostConstruct以及@PreDestroy。
@Resource的作用相當(dāng)于@Autowired,只不過@Autowired按byType自動(dòng)注入,而@Resource默認(rèn)按byName自動(dòng)注入罷了。@Resource有兩個(gè)屬性是比較重要的,分別是name和type,Spring將@Resource注解的name屬性解析為bean的名字,而type屬性則解析為bean的類型。所以如果使用name屬性,則使用byName的自動(dòng)注入策略,而使用type屬性時(shí)則使用byType自動(dòng)注入策略。如果既不指定name也不指定type屬性,這時(shí)將通過反射機(jī)制使用byName自動(dòng)注入策略。
@Resource裝配順序

如果同時(shí)指定了name和type,則從Spring上下文中找到唯一匹配的bean進(jìn)行裝配,找不到則拋出異常
如果指定了name,則從上下文中查找名稱(id)匹配的bean進(jìn)行裝配,找不到則拋出異常
如果指定了type,則從上下文中找到類型匹配的唯一bean進(jìn)行裝配,找不到或者找到多個(gè),都會(huì)拋出異常
如果既沒有指定name,又沒有指定type,則自動(dòng)按照byName方式進(jìn)行裝配(見2);如果沒有匹配,則回退為一個(gè)原始類型(UserDao)進(jìn)行匹配,如果匹配則自動(dòng)裝配;
1.6. @PostConstruct(JSR-250)
在方法上加上注解@PostConstruct,這個(gè)方法就會(huì)在Bean初始化之后被Spring容器執(zhí)行(注:Bean初始化包括,實(shí)例化Bean,并裝配Bean的屬性(依賴注入))。
它的一個(gè)典型的應(yīng)用場(chǎng)景是,當(dāng)你需要往Bean里注入一個(gè)其父類中定義的屬性,而你又無法復(fù)寫父類的屬性或?qū)傩缘膕etter方法時(shí),如: 

public class UserDaoImpl extends HibernateDaoSupport implements UserDao { 
  private SessionFactory mySessionFacotry; 
  @Resource 
  public void setMySessionFacotry(SessionFactory sessionFacotry) { 
    this.mySessionFacotry = sessionFacotry; 
  } 
  @PostConstruct 
  public void injectSessionFactory() { 
    super.setSessionFactory(mySessionFacotry); 
  } 
  ... 
}

這里通過@PostConstruct,為UserDaoImpl的父類里定義的一個(gè)sessionFactory私有屬性,注入了我們自己定義的sessionFactory(父類的setSessionFactory方法為final,不可復(fù)寫),之后我們就可以通過調(diào)用super.getSessionFactory()來訪問該屬性了。


1.7. @PreDestroy(JSR-250)
在方法上加上注解@PreDestroy,這個(gè)方法就會(huì)在Bean初始化之后被Spring容器執(zhí)行。由于我們當(dāng)前還沒有需要用到它的場(chǎng)景,這里不不去演示。其用法同@PostConstruct。

1.8. 使用<context:annotation-config />簡(jiǎn)化配置
Spring2.1添加了一個(gè)新的context的Schema命名空間,該命名空間對(duì)注釋驅(qū)動(dòng)、屬性文件引入、加載期織入等功能提供了便捷的配置。我們知道注釋本身是不會(huì)做任何事情的,它僅提供元數(shù)據(jù)信息。要使元數(shù)據(jù)信息真正起作用,必須讓負(fù)責(zé)處理這些元數(shù)據(jù)的處理器工作起來。
AutowiredAnnotationBeanPostProcessor和CommonAnnotationBeanPostProcessor就是處理這些注釋元數(shù)據(jù)的處理器。但是直接在Spring配置文件中定義這些Bean顯得比較笨拙。Spring為我們提供了一種方便的注冊(cè)這些BeanPostProcessor的方式,這就是<context:annotation-config />:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
  http://www.springframework.org/schema/context 
  http://www.springframework.org/schema/context/spring-context-2.5.xsd"> 
  <context:annotation-config /> 
</beans>

<context:annotationconfig />將隱式地向Spring容器注冊(cè)AutowiredAnnotationBeanPostProcessor、CommonAnnotationBeanPostProcessor、 PersistenceAnnotationBeanPostProcessor以及RequiredAnnotationBeanPostProcessor這4個(gè)BeanPostProcessor。

2. 使用Spring注解完成Bean的定義
以上我們介紹了通過@Autowired或@Resource來實(shí)現(xiàn)在Bean中自動(dòng)注入的功能,下面我們將介紹如何注解Bean,從而從XML配置文件中完全移除Bean定義的配置。

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

@Component 
public class UserDaoImpl extends HibernateDaoSupport implements UserDao { 
  ... 
}

使用@Component注解定義的Bean,默認(rèn)的名稱(id)是小寫開頭的非限定類名。如這里定義的Bean名稱就是userDaoImpl。你也可以指定Bean的名稱:
@Component("userDao")
@Component是所有受Spring管理組件的通用形式,Spring還提供了更加細(xì)化的注解形式:@Repository、@Service、@Controller,它們分別對(duì)應(yīng)存儲(chǔ)層Bean,業(yè)務(wù)層Bean,和展示層Bean。目前版本(2.5)中,這些注解與@Component的語義是一樣的,完全通用,在Spring以后的版本中可能會(huì)給它們追加更多的語義。所以,我們推薦使用@Repository、@Service、@Controller來替代@Component。

2.2. 使用<context:component-scan />讓Bean定義注解工作起來

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
  http://www.springframework.org/schema/context 
  http://www.springframework.org/schema/context/spring-context-2.5.xsd"> 
  <context:component-scan base-package="com.kedacom.ksoa" /> 
</beans>

這里,所有通過<bean>元素定義Bean的配置內(nèi)容已經(jīng)被移除,僅需要添加一行<context:component-scan />配置就解決所有問題了——Spring XML配置文件得到了極致的簡(jiǎn)化(當(dāng)然配置元數(shù)據(jù)還是需要的,只不過以注釋形式存在罷了)。<context:component-scan />的base-package屬性指定了需要掃描的類包,類包及其遞歸子包中所有的類都會(huì)被處理。
<context:component-scan />還允許定義過濾器將基包下的某些類納入或排除。Spring支持以下4種類型的過濾方式:

過濾器類型 表達(dá)式范例 說明
注解 org.example.SomeAnnotation 將所有使用SomeAnnotation注解的類過濾出來
類名指定 org.example.SomeClass 過濾指定的類
正則表達(dá)式 com\.kedacom\.spring\.annotation\.web\..* 通過正則表達(dá)式過濾一些類
AspectJ表達(dá)式 org.example..*Service+ 通過AspectJ表達(dá)式過濾一些類

以正則表達(dá)式為例,我列舉一個(gè)應(yīng)用實(shí)例:

<context:component-scan base-package="com.casheen.spring.annotation"> 
  <context:exclude-filter type="regex" expression="com\.casheen\.spring\.annotation\.web\..*" /> 
</context:component-scan>

值得注意的是<context:component-scan />配置項(xiàng)不但啟用了對(duì)類包進(jìn)行掃描以實(shí)施注釋驅(qū)動(dòng)Bean定義的功能,同時(shí)還啟用了注釋驅(qū)動(dòng)自動(dòng)注入的功能(即還隱式地在內(nèi)部注冊(cè)了AutowiredAnnotationBeanPostProcessor和CommonAnnotationBeanPostProcessor),因此當(dāng)使用<context:component-scan />后,就可以將<context:annotation-config />移除了。

2.3. 使用@Scope來定義Bean的作用范圍
在使用XML定義Bean時(shí),我們可能還需要通過bean的scope屬性來定義一個(gè)Bean的作用范圍,我們同樣可以通過@Scope注解來完成這項(xiàng)工作:

@Scope("session") 
@Component() 
public class UserSessionBean implements Serializable { 
  ... 
}

3.在使用annotation之前定義三個(gè)bean之間的關(guān)系是這樣的

package com.baobaotao;
public class Office {
  private String officeNo =”001”;
 
  //省略 get/setter
 
  @Override
  public String toString() {
    return "officeNo:" + officeNo;
  }
}

ackage com.baobaotao;
 
public class Car {
  private String brand;
  private double price;
 
  // 省略 get/setter
 
  @Override
  public String toString() {
    return "brand:" + brand + "," + "price:" + price;
  }
}

package com.baobaotao;
 
public class Boss {
  private Car car;
  private Office office;
 
  // 省略 get/setter
 
  @Override
  public String toString() {
    return "car:" + car + "\n" + "office:" + office;
  }
}

配置文件如下:

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
  <bean id="boss" class="com.baobaotao.Boss">
    <property name="car" ref="car"/>
    <property name="office" ref="office" />
  </bean>
  <bean id="office" class="com.baobaotao.Office">
    <property name="officeNo" value="002"/>
  </bean>
  <bean id="car" class="com.baobaotao.Car" scope="singleton">
    <property name="brand" value=" 紅旗 CA72"/>
    <property name="price" value="2000"/>
  </bean>
</beans>

測(cè)試文件如下:

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class AnnoIoCTest {
 
  public static void main(String[] args) {
    String[] locations = {"beans.xml"};
    ApplicationContext ctx = 
      new ClassPathXmlApplicationContext(locations);
    Boss boss = (Boss) ctx.getBean("boss");
    System.out.println(boss);
  }
}

 
4.接下來我們可以使用autowired來注解,他可以對(duì)成員變量,方法及構(gòu)造函數(shù)進(jìn)行標(biāo)準(zhǔn),完成自動(dòng)裝配的工作。

autoware來注解成員變量的用法

package com.baobaotao;
import org.springframework.beans.factory.annotation.Autowired;
 
public class Boss {
 
  @Autowired
  private Car car;
 
  @Autowired
  private Office office;
 
  …
}

相應(yīng)的配置文件如下:

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 
  <!-- 該 BeanPostProcessor 將自動(dòng)起作用,對(duì)標(biāo)注 @Autowired 的 Bean 進(jìn)行自動(dòng)注入 -->
  <bean class="org.springframework.beans.factory.annotation.
    AutowiredAnnotationBeanPostProcessor"/>
 
  <!-- 移除 boss Bean 的屬性注入配置的信息 -->
  <bean id="boss" class="com.baobaotao.Boss"/>
 
  <bean id="office" class="com.baobaotao.Office">
    <property name="officeNo" value="001"/>
  </bean>
  <bean id="car" class="com.baobaotao.Car" scope="singleton">
    <property name="brand" value=" 紅旗 CA72"/>
    <property name="price" value="2000"/>
  </bean>
</beans>

autoware也可以用在setter方法及構(gòu)造函數(shù)上

package com.baobaotao;
 
public class Boss {
  private Car car;
  private Office office;
 
   @Autowired
  public void setCar(Car car) {
    this.car = car;
  }
 
  @Autowired
  public void setOffice(Office office) {
    this.office = office;
  }
  …
}

package com.baobaotao;
 
public class Boss {
  private Car car;
  private Office office;
 
  @Autowired
  public Boss(Car car ,Office office){
    this.car = car;
    this.office = office ;
  }
 
  …
}

當(dāng)候選bean的數(shù)目為0時(shí),我們可以使用@Autowired(required = false)來防止spring找不到bean時(shí)報(bào)錯(cuò)。

當(dāng)有多個(gè)候選bean的時(shí)候,我們可以通過@Qualifier 注釋指定注入 Bean 的名稱。

@Autowired 和 @Qualifier 結(jié)合使用時(shí),自動(dòng)注入的策略就從 byType 轉(zhuǎn)變成 byName 了。@Autowired 可以對(duì)成員變量、方法以及構(gòu)造函數(shù)進(jìn)行注釋,而 @Qualifier 的標(biāo)注對(duì)象是成員變量、方法入?yún)?、?gòu)造函數(shù)入?yún)?。正是由于注釋?duì)象的不同,所以 Spring 不將 @Autowired 和 @Qualifier 統(tǒng)一成一個(gè)注釋類。

5.@resorce是按照名字來進(jìn)行反射,他有兩個(gè)參數(shù),name和type,使用name即按照byname來映射,使用type即按照bytype來進(jìn)行映射。

package com.baobaotao;
 
import javax.annotation.Resource;
 
public class Boss {
  // 自動(dòng)注入類型為 Car 的 Bean
  @Resource
  private Car car;
 
  // 自動(dòng)注入 bean 名稱為 office 的 Bean
  @Resource(name = "office")
  private Office office;
}
@postconstructor和preDestory是用來注解類初始化后和銷毀前的方法。 


package com.baobaotao;
 
import javax.annotation.Resource;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
 
public class Boss {
  @Resource
  private Car car;
 
  @Resource(name = "office")
  private Office office;
 
  @PostConstruct
  public void postConstruct1(){
    System.out.println("postConstruct1");
  }
 
  @PreDestroy
  public void preDestroy1(){
    System.out.println("preDestroy1"); 
  }
  …
}

6.@compent可以直接定義bean,這樣xml配置文件中就不需要配置bean了

package com.baobaotao;
 
import org.springframework.stereotype.Component;
 
@Component
public class Car {
  …
}

package com.baobaotao;
 
import org.springframework.stereotype.Component;
 
@Component
public class Office {
  private String officeNo = "001";
  …
}

package com.baobaotao;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
 
@Component("boss")
public class Boss {
  @Autowired
  private Car car;
 
  @Autowired
  private Office office;
  …
}

@Component 有一個(gè)可選的入?yún)?,用于指?Bean 的名稱,在 Boss 中,我們就將 Bean 名稱定義為“boss”。一般情況下,Bean 都是 singleton 的,需要注入 Bean 的地方僅需要通過 byType 策略就可以自動(dòng)注入了,所以大可不必指定 Bean 的名稱。

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
 http://www.springframework.org/schema/context 
 http://www.springframework.org/schema/context/spring-context-2.5.xsd">
  <context:component-scan base-package="com.baobaotao"/>
</beans>

7.@scope可以用來指定其目標(biāo)

package com.baobaotao;
import org.springframework.context.annotation.Scope;
…
@Scope("prototype")
@Component("boss")
public class Boss {


Spring 2.5 中除了提供 @Component 注釋外,還定義了幾個(gè)擁有特殊語義的注釋,它們分別是:@Repository、@Service 和 @Controller。在目前的 Spring 版本中,這 3 個(gè)注釋和 @Component 是等效的,但是從注釋類的命名上,很容易看出這 3 個(gè)注釋分別和持久層、業(yè)務(wù)層和控制層(Web 層)相對(duì)應(yīng)。雖然目前這 3 個(gè)注釋和 @Component 相比沒有什么新意,但 Spring 將在以后的版本中為它們添加特殊的功能。所以,如果 Web 應(yīng)用程序采用了經(jīng)典的三層分層結(jié)構(gòu)的話,最好在持久層、業(yè)務(wù)層和控制層分別采用 @Repository、@Service 和 @Controller 對(duì)分層中的類進(jìn)行注釋,而用 @Component 對(duì)那些比較中立的類進(jìn)行注釋。

相關(guān)文章

  • Java基礎(chǔ)之邏輯運(yùn)算符知識(shí)總結(jié)

    Java基礎(chǔ)之邏輯運(yùn)算符知識(shí)總結(jié)

    今天帶大家學(xué)習(xí)Java基礎(chǔ)知識(shí),文中對(duì)Java邏輯運(yùn)算符進(jìn)行了非常詳細(xì)的介紹,有相關(guān)代碼示例,對(duì)正在學(xué)習(xí)java的小伙伴很有幫助,需要的朋友可以參考下
    2021-05-05
  • java面試LruCache?和?LinkedHashMap及算法實(shí)現(xiàn)

    java面試LruCache?和?LinkedHashMap及算法實(shí)現(xiàn)

    這篇文章主要為大家介紹了java面試LruCache?和?LinkedHashMap及算法實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-02-02
  • 利用spring的攔截器自定義緩存的實(shí)現(xiàn)實(shí)例代碼

    利用spring的攔截器自定義緩存的實(shí)現(xiàn)實(shí)例代碼

    這篇文章主要介紹了利用spring的攔截器自定義緩存的實(shí)現(xiàn)實(shí)例代碼,分享了相關(guān)代碼示例,小編覺得還是挺不錯(cuò)的,具有一定借鑒價(jià)值,需要的朋友可以參考下
    2018-02-02
  • Spring Boot之@Async異步線程池示例詳解

    Spring Boot之@Async異步線程池示例詳解

    在Spring Boot中,我們只需要通過使用@Async注解就能簡(jiǎn)單的將原來的同步函數(shù)變?yōu)楫惒胶瘮?shù),下面這篇文章主要給大家介紹了關(guān)于Spring Boot之@Async異步線程池的相關(guān)資料,需要的朋友可以參考下
    2021-09-09
  • 解讀spark添加二方包導(dǎo)致依賴沖突排查問題

    解讀spark添加二方包導(dǎo)致依賴沖突排查問題

    這篇文章主要介紹了spark添加二方包導(dǎo)致依賴沖突排查問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-06-06
  • 關(guān)于RestTemplate的使用深度解析

    關(guān)于RestTemplate的使用深度解析

    這篇文章主要介紹了對(duì)RestTemplate的深度解析,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-10-10
  • Jenkins配置前端自動(dòng)打包部署全過程(若依項(xiàng)目)

    Jenkins配置前端自動(dòng)打包部署全過程(若依項(xiàng)目)

    Jenkins作為一個(gè)開源的自動(dòng)化服務(wù)器,廣泛用于持續(xù)集成、持續(xù)部署(CI/CD)流程中,這篇文章主要給大家介紹了關(guān)于Jenkins配置前端自動(dòng)打包部署(若依項(xiàng)目)的相關(guān)資料,文中通過圖文介紹的非常詳細(xì),需要的朋友可以參考下
    2024-09-09
  • SpringCloud消息總線Bus配置中心實(shí)現(xiàn)過程解析

    SpringCloud消息總線Bus配置中心實(shí)現(xiàn)過程解析

    這篇文章主要介紹了SpringCloud消息總線Bus配置中心實(shí)現(xiàn)過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-03-03
  • 完美解決idea突然間很卡的問題

    完美解決idea突然間很卡的問題

    這篇文章主要介紹了完美解決idea突然間很卡的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2021-02-02
  • Java編程實(shí)現(xiàn)獲取mp3時(shí)長(zhǎng)及播放mp3文件的方法

    Java編程實(shí)現(xiàn)獲取mp3時(shí)長(zhǎng)及播放mp3文件的方法

    這篇文章主要介紹了Java編程實(shí)現(xiàn)獲取mp3時(shí)長(zhǎng)及播放mp3文件的方法,涉及java基于jaudiotagger與jl包對(duì)MP3音頻文件屬性操作及音頻播放相關(guān)操作技巧,并提供了相關(guān)jar包的本站下載,需要的朋友可以參考下
    2018-02-02

最新評(píng)論

威宁| 吉首市| 凤阳县| 寻甸| 河曲县| 朝阳县| 华容县| 古丈县| 广州市| 灵宝市| 娄底市| 平潭县| 余姚市| 闵行区| 游戏| 错那县| 石门县| 绥中县| 开远市| 湖口县| 嘉定区| 富平县| 扶绥县| 嘉荫县| 托里县| 文登市| 临江市| 大英县| 大同市| 临沂市| 正安县| 惠来县| 上虞市| 台东县| 镇江市| 大城县| 进贤县| 昭苏县| 绥芬河市| 治多县| 庄河市|