什么是JavaConfig?

什么是JavaConfig?,第1张

JavaConfig就是使用注释来描述Bean配置的组件。JavaConfig 是Spring的一个子项目。

传统spring一般都是基于xml配置的,不过后来新增了许多JavaConfig的注解。特别是springboot,基本都是清一色的java config

使用流读取就可以了,给你个例子,如下:

public class ReaderFileLine {

public static String getFileContent1(String path) {

StringBuilder sb = new StringBuilder()

try {

File file = new File(path)

InputStreamReader read = new InputStreamReader(new FileInputStream(file), "UTF-8")

BufferedReader reader = new BufferedReader(read)

String line

while((line = reader.readLine()) != null) {

sb.append(line)

}

} catch (UnsupportedEncodingException e) {

e.printStackTrace()

} catch (FileNotFoundException e) {

e.printStackTrace()

} catch (IOException e) {

e.printStackTrace()

}

return sb.toString()

}

public static void main(String[] args) {

System.out.println(getFileContent1("D:\\ntp.cfg"))

}

}

这是因为你没有调用TEMP.H这个头文件在主函数中加入就可以了。

cfg是大多数软件的配置文件,也是编译器在内部维护的时候所产生的相关文件;cfg文件也是一种文本文件,可以使用记事本、EditPlus工具打开。

Main在计算机软件中代码主菜单或者主类。一些桌面软件,都会有一个主菜单,包含基本的 *** 作菜单,命名为main。在开发语言java、c语言等高级语言中,都会存在一个main的主类,是程序执行的入口。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11693655.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存