常用技巧

  1. Paths.get(String first, String...more)会返回一个安全的拼装路径,无论是正斜杠反斜杠或者不传斜杠都能返回拼装好的夸平台的路径
  2. String.format(模板,p1,p2,p3,...) 字符串拼接例如:String.format("%s %d %.1f","hello",1,0.2)
  3. 在Spring初始化Bean之后进行操作
//实现InitializingBean 接口后在afterPropertiesSet中进行初始化操作
@Component
public class FileService implements InitializingBean {
 @Override
    public void afterPropertiesSet() throws Exception {
        auth = Auth.create(qiNiuConfig.getACCESS_KEY(), qiNiuConfig.getSECRET_KEY());
        uploadManager = new UploadManager(new Configuration());
    }
}

你可能感兴趣的:(常用技巧)