<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
@Configuration
public class NftServerStartConfiguration {
@Bean
@ConditionalOnProperty(prefix = "nft.server",name = "enabled", havingValue = "true")
public void startBoot(){
System.out.println("服务开启并启动了,欢迎使用ntfServer服务");
}
}
用import将第二步编写的配置类导入到注解中,让注解管理起来
/**
* nftserver注解开启
* @author marlon
* @create 2024-01-18 10:38
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Import(value = NftServerStartConfiguration.class)
@Documented
@Inherited
public @interface NftServer {
}
<dependency>
<groupId>cn.com.agree.adfs</groupId>
<artifactId>nft-server-sdk-starter</artifactId>
<version>2.6.1</version>
</dependency>
nft:
server:
enabled: true
@SpringBootApplication
@NftServer
public class AdfsDemoApplication {
public static void main(String[] args) {
SpringApplication.run(AdfsDemoApplication.class);
}
}