面试-高频问题一

一、系统上传大文件怎么处理:
上传大文件报内存溢出的解决办法:修改tomcat的内存,给与相应的内存,下载文件一段段的读取
 public static byte[] getBytesFromFile(File file) {
        if (file == null) {
            return null;
        }
        FileInputStream stream = null;
        ByteArrayOutputStream out = null;
        try {
            stream = new FileInputStream(file);
            out = new ByteArrayOutputStream(1000);
            byte[] b = new byte[1000];
            int n;
            while ((n = stream.read(b)) != -1) {
                out.write(b, 0, n);
            }
            return out.toByteArray();
        } catch (IOException e) {
            LOG.error(e);
        } finally {
            try {
                if (stream != null) {
                    stream.close();
                }
                if (out != null) {
                    out.close();
                }
            } catch (IOException e) {
                LOG.error(e);
            }
        }
        return null;
    }java

二、java虚拟机jvm底层为何会内存溢出spring

三、对spring的理解
其核心就是IOC、AOP设计模式

四、设计模式(单例模式)tomcat

五、AOP的动态代理
 jvm

高频问题!!!!设计