JAVA-8366: Split or move spring-boot-annotations module
This commit is contained in:
-9
@@ -1,9 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWarDeployment;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnWarDeployment
|
||||
public class AdditionalWebConfiguration {
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.springframework.boot.system.JavaVersion;
|
||||
|
||||
public class ConditionalUtils {
|
||||
|
||||
public static boolean isWindows() {
|
||||
return SystemUtils.IS_OS_WINDOWS;
|
||||
}
|
||||
|
||||
public static boolean isJava8() {
|
||||
return JavaVersion.getJavaVersion().equals(JavaVersion.EIGHT);
|
||||
}
|
||||
|
||||
public static boolean isJava9() {
|
||||
return JavaVersion.getJavaVersion().equals(JavaVersion.NINE);
|
||||
}
|
||||
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@Conditional(IsDevEnvCondition.class)
|
||||
public class DevEnvLoggingConfiguration {
|
||||
|
||||
@Bean
|
||||
@Conditional(IsDevEnvCondition.class)
|
||||
LoggingService loggingService() {
|
||||
return new LoggingService();
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
public class IsDevEnvCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
return "dev".equals(System.getProperty("env"));
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
public class IsWindowsCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
return ConditionalUtils.isWindows();
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
public class Java8Condition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
return ConditionalUtils.isJava8();
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Conditional(Java8Condition.class)
|
||||
public class Java8DependedService {
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
|
||||
public class Java8OrJava9 extends AnyNestedCondition {
|
||||
Java8OrJava9() {
|
||||
super(ConfigurationPhase.REGISTER_BEAN);
|
||||
}
|
||||
|
||||
@Conditional(Java8Condition.class)
|
||||
static class Java8 { }
|
||||
|
||||
@Conditional(Java9Condition.class)
|
||||
static class Java9 { }
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
public class Java9Condition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
return ConditionalUtils.isJava9();
|
||||
}
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.baeldung.annotations.conditional;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.system.JavaVersion;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Conditional({IsDevEnvCondition.class, IsWindowsCondition.class, Java8Condition.class})
|
||||
@ConditionalOnProperty(
|
||||
value = "logging.enabled",
|
||||
havingValue = "true",
|
||||
matchIfMissing = true)
|
||||
@ConditionalOnExpression("${logging.enabled:true} and '${logging.level}'.equals('DEBUG')")
|
||||
@ConditionalOnJava(JavaVersion.EIGHT)
|
||||
public class LoggingService {
|
||||
}
|
||||
Reference in New Issue
Block a user