c语言sscanf函数的用法是什么
246
2022-11-26
SpringBoot:@Conditional
package tju.SpringBootSecurityJdbc.controller;import org.springframework.context.annotation.Condition;import org.springframework.context.annotation.ConditionContext;import org.springframework.core.env.Environment;import org.springframework.core.type.AnnotatedTypeMetadata;public class MyCondition implements Condition{ @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { Environment env=context.getEnvironment(); if(env.containsProperty("myswitch")) { String str=env.getProperty("myswitch"); if(str.equals("true"))return true; } return false; }}
package tju.SpringBootSecurityJdbc.controller;import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;import org.springframework.context.annotation.Conditional;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestController@Conditional(MyCondition.class)public class AppController3 { @RequestMapping("/halu2") public String testme() { return "this is rest2!"; }}
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/springboot spring.datasource.username=root spring.datasource.password=root logging.level.org.springframework.security=trace spring.thymeleaf.cache=false test.fgh.enabled=true my.user.num=2 com.abc=fgh myswitch=true
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~