Skip to content

Commit 61a44de

Browse files
committed
Add SpringHeaderCheck to enforce using "2012-present"
This commit also fixes copyright headers that don't follow it. Signed-off-by: Johnny Lim <[email protected]>
1 parent 7fb5369 commit 61a44de

File tree

9 files changed

+14
-16
lines changed

9 files changed

+14
-16
lines changed

config/checkstyle/checkstyle.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<property name="file" value="${config_loc}/checkstyle-suppressions.xml"/>
88
</module>
99
<module name="io.spring.javaformat.checkstyle.SpringChecks" />
10+
<module name="io.spring.javaformat.checkstyle.check.SpringHeaderCheck">
11+
<property name="headerCopyrightPattern" value="2012-present" />
12+
</module>
1013
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">
1114
<module name="io.spring.javaformat.checkstyle.check.SpringDeprecatedCheck" />
1215
<module name="io.spring.javaformat.checkstyle.check.SpringJUnit5Check" />

core/spring-boot/src/main/java/org/springframework/boot/context/metrics/buffering/BufferedStartupStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-present the original author or authors.
2+
* Copyright 2012-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/spring-boot/src/main/java/org/springframework/boot/context/metrics/buffering/BufferingApplicationStartup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-present the original author or authors.
2+
* Copyright 2012-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/spring-boot/src/main/java/org/springframework/boot/context/metrics/buffering/StartupTimeline.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-present the original author or authors.
2+
* Copyright 2012-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/spring-boot/src/main/java/org/springframework/boot/context/properties/ConstructorBound.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-present the original author or authors.
2+
* Copyright 2012-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/spring-boot/src/main/java/org/springframework/boot/convert/PeriodStyle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-present the original author or authors.
2+
* Copyright 2012-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

core/spring-boot/src/main/java/org/springframework/boot/convert/PeriodToStringConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-present the original author or authors.
2+
* Copyright 2012-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/graphql/runtimewiring/GreetingController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-present the original author or authors.
2+
* Copyright 2012-present the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

module/spring-boot-metrics/src/test/java/org/springframework/boot/metrics/autoconfigure/MetricsAspectsAutoConfigurationTests.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
3232
import org.springframework.context.annotation.Bean;
3333
import org.springframework.context.annotation.Configuration;
34-
import org.springframework.test.util.ReflectionTestUtils;
3534

3635
import static org.assertj.core.api.Assertions.assertThat;
3736
import static org.mockito.Mockito.mock;
@@ -70,8 +69,7 @@ void shouldAutoConfigureMeterTagAnnotationHandlerWhenValueExpressionResolverIsAv
7069
this.contextRunner.withBean(ValueExpressionResolver.class, () -> mock(ValueExpressionResolver.class))
7170
.run((context) -> {
7271
assertThat(context).hasSingleBean(TimedAspect.class).hasSingleBean(MeterTagAnnotationHandler.class);
73-
assertThat(
74-
ReflectionTestUtils.getField(context.getBean(TimedAspect.class), "meterTagAnnotationHandler"))
72+
assertThat(context.getBean(TimedAspect.class)).extracting("meterTagAnnotationHandler")
7573
.isSameAs(context.getBean(MeterTagAnnotationHandler.class));
7674
});
7775
}
@@ -83,8 +81,7 @@ void shouldUseUserDefinedMeterTagAnnotationHandler() {
8381
() -> new MeterTagAnnotationHandler(null, null))
8482
.run((context) -> {
8583
assertThat(context).hasSingleBean(TimedAspect.class).hasSingleBean(MeterTagAnnotationHandler.class);
86-
assertThat(
87-
ReflectionTestUtils.getField(context.getBean(TimedAspect.class), "meterTagAnnotationHandler"))
84+
assertThat(context.getBean(TimedAspect.class)).extracting("meterTagAnnotationHandler")
8885
.isSameAs(context.getBean("customMeterTagAnnotationHandler"));
8986
});
9087
}
@@ -95,8 +92,7 @@ void shouldAutoConfigureCountedMeterTagAnnotationHandlerWhenValueExpressionResol
9592
.run((context) -> {
9693
assertThat(context).hasSingleBean(CountedAspect.class)
9794
.hasSingleBean(CountedMeterTagAnnotationHandler.class);
98-
assertThat(
99-
ReflectionTestUtils.getField(context.getBean(CountedAspect.class), "meterTagAnnotationHandler"))
95+
assertThat(context.getBean(CountedAspect.class)).extracting("meterTagAnnotationHandler")
10096
.isSameAs(context.getBean(CountedMeterTagAnnotationHandler.class));
10197
});
10298
}
@@ -109,8 +105,7 @@ void shouldUseUserDefinedCountedMeterTagAnnotationHandler() {
109105
.run((context) -> {
110106
assertThat(context).hasSingleBean(CountedAspect.class)
111107
.hasSingleBean(CountedMeterTagAnnotationHandler.class);
112-
assertThat(
113-
ReflectionTestUtils.getField(context.getBean(CountedAspect.class), "meterTagAnnotationHandler"))
108+
assertThat(context.getBean(CountedAspect.class)).extracting("meterTagAnnotationHandler")
114109
.isSameAs(context.getBean(CountedMeterTagAnnotationHandler.class));
115110
});
116111
}

0 commit comments

Comments
 (0)