2 results for java
  • spring基础知识 Spring Bean通俗解释: Bean是啥 1. Java面向对象,对象有方法和属性,那么就需要对象实例来调用方法和属性(即实例化); 2. 凡是有方法或属性的类都需要实例化,这样才能具象化去使用这些方法和属性; 3. 规律:凡是子类及带有方法或属性的类都要加上注册Bean到Spring IoC的注解; 4. 把Bean理解为类的代理或代言人(实际上确实是通过反射、代理来实现的),这样它就能代表类拥有该拥有的东西了 5. 我们都在微博上@过某某,对方会优先看到这条信息,并给你反馈,那么在Spring中,你标识一个@符号,那么Spring就会来看看,并且从这里拿到一个Bean或者给出一个Bean 注解分为两类: 1、一类是使用Bean,即是把已经在xml文件中配置好的Bean拿来用,完成属性、方法的组装;比如@Autowired , @Resource,可以通过byTYPE(@Autowired)、byNAME(@Resource)的方式获取Bean; 2、一类是注册Bean,@Component , @Repository , @ Controller , …
    java framework spring Created Wed, 26 Apr 2023 16:19:41 +0900
  • 字节流 public void FileDownload(String fileName, HttpServletResponse response) { FileInputStream fis = null; ByteArrayOutputStream bos = null; System.out.println(fileName); try { // 文件 String fn = new StringBuilder("static/sampleFile/").append(fileName).toString(); File file = new File(getClass().getClassLoader().getResource(fn).getFile()); // InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fn); // 文件转字节流 byte[] fileByte = File2byteUtil.file2byte(file); // 字节流输出 // …
    java Created Fri, 11 Nov 2022 11:14:15 +0900