Attributes should be specified via @SpringBootApplication
一、描述
设置EnableAutoConfiguration,如下
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableAutoConfiguration(exclude = {org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration.class})
@EnableScheduling
public class DQServerApplication {
public static void main(String[] args) {
System.setProperty("mail.mime.splitlongparameters", "false");
SpringApplication.run(DQServerApplication.class, args);
}
}
在idea中报如下错误
二、分析
查看代码发现,SpringBootApplication中已经包含EnableAutoConfiguration,不需要重复定义
三、解决方法
去掉EnableAutoConfiguration即可,如下
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration.class})
@EnableScheduling
public class DQServerApplication {
public static void main(String[] args) {
System.setProperty("mail.mime.splitlongparameters", "false");
SpringApplication.run(DQServerApplication.class, args);
}
}