您应该将
@ConditionalOnProperty注释移至类,而不是方法。
@PropertySource(value = "classpath:securityConfig.properties", ignoreResourceNotFound = true)@Controller@ConditionalOnProperty(name = "auth.mode", havingValue = "fixed")public class IndexController { ...}这意味着除非满足条件,否则整个控制器将不存在于应用程序上下文中。



