方法1:
启动类上注解@SpringBootApplication后,用 exclude 属性进行排除指定的类:
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class UserApplication {
}
方法2:
@SpringCloudApplication :
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class UserApplication {
}
方法3:
@EnableAutoConfiguration :
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class UserApplication {
}
终极方法--yml配置:
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration