# Failed to parse multipart servlet request; nested exception is java.io.IOException

在application.yml文件中设置multipart location ,并重启项目

spring:
  http:
    multipart:
      location: /data/upload_tmp

在application.yml文件中设置

server
  tomcat:
     basedir: /tmp/tomcat

在配置文件添加bean

@Bean
public MultipartConfigElement multipartConfigElement() {
  MultipartConfigFactory factory = new MultipartConfigFactory();
  factory.setLocation("/tmp/tomcat");
  return factory.createMultipartConfig();
}

添加启动参数 -java.tmp.dir=/path/to/application/temp/,并重启

# Could not resolve view with name 'xxx' in servlet with name 'xxx'

使用@RestController注解,或者在方法上面注解@ResponseBody注解

# SpringBoot security关闭验证

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable()
                .authorizeRequests()
                .anyRequest().permitAll()
                .and().logout().permitAll();
    }

}

# To Be Continued!😎

Last Updated: 4/9/2021, 9:12:35 AM