Skip to content

Commit d43eb93

Browse files
authored
Merge pull request #30 from spt-development/feature/spring-boot-3.2.5-upgrade
Feature/spring boot 3.2.5 upgrade
2 parents adace37 + 92cbb04 commit d43eb93

File tree

9 files changed

+90
-18
lines changed

9 files changed

+90
-18
lines changed

.github/maven-settings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
</activation>
2424
<properties>
2525
<gpg.executable>gpg</gpg.executable>
26-
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
2726
</properties>
2827
</profile>
2928
</profiles>

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
persist-credentials: false
1414

1515
- name: Cache local Maven repository
16-
uses: actions/cache@v3
16+
uses: actions/cache@v4
1717
with:
1818
path: ~/.m2/repository
1919
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -68,7 +68,7 @@ jobs:
6868
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
6969
GIT_HUB_USERNAME: ${{ secrets.GIT_HUB_USERNAME }}
7070
GIT_HUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
71-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
71+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
7272

7373
- name: Create GitHub release
7474
id: create_release

.github/workflows/owasp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
shell: bash
1717

1818
- name: Restore cached Maven dependencies
19-
uses: actions/cache/restore@v3
19+
uses: actions/cache/restore@v4
2020
with:
2121
path: ~/.m2/repository
2222
# Using datetime in cache key as OWASP database may change, without the pom changing
@@ -36,7 +36,7 @@ jobs:
3636

3737
# Want the Maven dependencies to be cached even if the build fails as we want the OWASP database cached, regardless of whether vulnerabilities are found or not
3838
- name: Cache Maven dependencies
39-
uses: actions/cache/save@v3
39+
uses: actions/cache/save@v4
4040
if: always()
4141
with:
4242
path: ~/.m2/repository
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## New Features
2+
3+
* Added logging for public methods of classes that extend `org.springframework.dao.support.DaoSupport`.
4+
* This logging support results in warnings being logged by `CglibAopProxy` when Spring Boot apps start, therefore this feature is disabled by default.
5+
* Enable by setting the `spt.logging.dao-support.enabled` property to `true`.
6+
* Alternatively, accept the warnings logged at start-up or configure logging to *not* log `CglibAopProxy` warnings.
7+
8+
## Dependencies
9+
10+
* Aligned dependencies with [Spring Boot 3.2.5](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.5)

pom.xml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,38 @@
4040
<maven.min.version>3.9.4</maven.min.version>
4141

4242
<!-- Dependency versions -->
43-
<spring-boot.version>3.2.4</spring-boot.version>
43+
<spring-boot.version>3.2.5</spring-boot.version>
4444
<spt-cid.version>2.0.14</spt-cid.version>
45-
<spt-logging-spring.version>3.0.16</spt-logging-spring.version>
45+
<spt-logging-spring.version>3.1.0</spt-logging-spring.version>
4646

4747
<!-- Plugin versions -->
4848
<build-helper-maven-plugin.version>3.5.0</build-helper-maven-plugin.version>
4949
<checkstyle-maven-plugin.version>3.3.1</checkstyle-maven-plugin.version>
50-
<dependency-check-maven.version>9.0.10</dependency-check-maven.version>
51-
<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
50+
<dependency-check-maven.version>9.1.0</dependency-check-maven.version>
51+
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
5252
<license-maven-plugin.version>2.4.0</license-maven-plugin.version>
5353
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
5454
<maven-dependency-plugin.version>3.6.1</maven-dependency-plugin.version>
5555
<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>
56-
<maven-gpg-plugin.version>3.2.1</maven-gpg-plugin.version>
56+
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
5757
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
5858
<maven-jxr-plugin.version>3.3.2</maven-jxr-plugin.version>
59-
<maven-pmd-plugin.version>3.21.2</maven-pmd-plugin.version>
59+
<maven-pmd-plugin.version>3.22.0</maven-pmd-plugin.version>
6060
<maven-release-plugin.version>3.0.1</maven-release-plugin.version>
61-
<maven-scm-plugin.version>2.0.1</maven-scm-plugin.version>
62-
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
61+
<maven-scm-plugin.version>2.1.0</maven-scm-plugin.version>
62+
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
6363
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
6464
<nexus-staging-plugin.version>1.6.13</nexus-staging-plugin.version>
65-
<pitest-maven.version>1.15.8</pitest-maven.version>
66-
<spotbugs.version>4.8.3.1</spotbugs.version>
65+
<pitest-maven.version>1.16.0</pitest-maven.version>
66+
<spotbugs.version>4.8.4.0</spotbugs.version>
6767
<versions-maven-plugin.version>2.16.2</versions-maven-plugin.version>
6868

6969
<!-- Plugin dependencies -->
70-
<checkstyle.version>10.14.2</checkstyle.version>
70+
<checkstyle.version>10.15.0</checkstyle.version>
7171
<findbugs-slf4j-bug-pattern.version>1.5.0</findbugs-slf4j-bug-pattern.version>
7272
<findbugs-sec-bug-pattern.version>1.12.0</findbugs-sec-bug-pattern.version>
7373
<pitest-junit5-plugin.version>1.2.1</pitest-junit5-plugin.version>
74+
<pmd.version>7.1.0</pmd.version>
7475
</properties>
7576

7677
<dependencyManagement>
@@ -186,6 +187,28 @@
186187
<plugin>
187188
<artifactId>maven-pmd-plugin</artifactId>
188189
<version>${maven-pmd-plugin.version}</version>
190+
<dependencies>
191+
<dependency>
192+
<groupId>net.sourceforge.pmd</groupId>
193+
<artifactId>pmd-core</artifactId>
194+
<version>${pmd.version}</version>
195+
</dependency>
196+
<dependency>
197+
<groupId>net.sourceforge.pmd</groupId>
198+
<artifactId>pmd-java</artifactId>
199+
<version>${pmd.version}</version>
200+
</dependency>
201+
<dependency>
202+
<groupId>net.sourceforge.pmd</groupId>
203+
<artifactId>pmd-javascript</artifactId>
204+
<version>${pmd.version}</version>
205+
</dependency>
206+
<dependency>
207+
<groupId>net.sourceforge.pmd</groupId>
208+
<artifactId>pmd-jsp</artifactId>
209+
<version>${pmd.version}</version>
210+
</dependency>
211+
</dependencies>
189212
</plugin>
190213
<plugin>
191214
<artifactId>maven-release-plugin</artifactId>

spt-development-logging-spring-boot-autoconfigure/config/pmd/rulesets/spt-default-rules.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
<rule ref="category/java/bestpractices.xml/DoubleBraceInitialization" />
2020
<rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach" />
2121
<rule ref="category/java/bestpractices.xml/LiteralsFirstInComparisons" />
22-
<rule ref="category/java/bestpractices.xml/LooseCoupling" />
22+
<rule ref="category/java/bestpractices.xml/LooseCoupling">
23+
<properties>
24+
<property name="allowedTypes" value="org.springframework.core.annotation.AnnotationAttributes" />
25+
</properties>
26+
</rule>
2327
<rule ref="category/java/bestpractices.xml/MethodReturnsInternalArray" />
2428
<rule ref="category/java/bestpractices.xml/MissingOverride" />
2529
<rule ref="category/java/bestpractices.xml/OneDeclarationPerLine" />
@@ -101,7 +105,7 @@
101105
<rule ref="category/java/design.xml/SwitchDensity" />
102106
<rule ref="category/java/design.xml/UseUtilityClass">
103107
<properties>
104-
<property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration/preceding-sibling::Annotation/MarkerAnnotation/Name[@Image='SpringBootApplication']" />
108+
<property name="violationSuppressXPath" value=".[pmd-java:hasAnnotation('org.springframework.boot.autoconfigure.SpringBootApplication')]" />
105109
</properties>
106110
</rule>
107111
<rule ref="category/java/design.xml/UselessOverridingMethod" />

spt-development-logging-spring-boot-autoconfigure/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
<artifactId>spring-jms</artifactId>
3030
<optional>true</optional>
3131
</dependency>
32+
<dependency>
33+
<groupId>org.springframework</groupId>
34+
<artifactId>spring-tx</artifactId>
35+
<optional>true</optional>
36+
</dependency>
3237
<dependency>
3338
<groupId>org.springframework</groupId>
3439
<artifactId>spring-web</artifactId>
@@ -62,6 +67,13 @@
6267
<scope>test</scope>
6368
</dependency>
6469

70+
<!-- Spring test dependencies - version defined in spring-boot bom, import in parent dependencyManagement section -->
71+
<dependency>
72+
<groupId>org.springframework.boot</groupId>
73+
<artifactId>spring-boot-test</artifactId>
74+
<scope>test</scope>
75+
</dependency>
76+
6577
<!-- Test dependencies not directly related to testing - version defined in spring-boot bom, import in parent dependencyManagement section -->
6678
<dependency>
6779
<groupId>ch.qos.logback</groupId>

spt-development-logging-spring-boot-autoconfigure/src/main/java/com/spt/development/logging/spring/boot/autoconfigure/LoggingSpringAutoConfiguration.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.spt.development.logging.spring.boot.autoconfigure;
22

3+
import com.spt.development.logging.spring.DaoSupportLogger;
34
import com.spt.development.logging.spring.JmsListenerLogger;
45
import com.spt.development.logging.spring.RepositoryLogger;
56
import com.spt.development.logging.spring.RestControllerLogger;
@@ -8,7 +9,9 @@
89
import org.springframework.boot.autoconfigure.AutoConfiguration;
910
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
1011
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
12+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
1113
import org.springframework.context.annotation.Bean;
14+
import org.springframework.dao.support.DaoSupport;
1215
import org.springframework.jms.annotation.JmsListener;
1316
import org.springframework.web.bind.annotation.RestController;
1417

@@ -80,4 +83,18 @@ public ServiceLogger serviceLogger() {
8083
public RepositoryLogger repositoryLogger() {
8184
return new RepositoryLogger(mdcDisabled);
8285
}
86+
87+
/**
88+
* Creates a vanilla {@link DaoSupportLogger} (aspect) bean. If the <code>spt.cid.mdc.disabled</code> property is
89+
* set to <code>true</code>, the correlation ID will be included in the generated log statements.
90+
*
91+
* @return a new {@link DaoSupportLogger} bean.
92+
*/
93+
@Bean
94+
@ConditionalOnMissingBean
95+
@ConditionalOnClass({ DaoSupport.class })
96+
@ConditionalOnProperty(value = "spt.logging.dao-support.enabled", havingValue = "true")
97+
public DaoSupportLogger daoSupportLogger() {
98+
return new DaoSupportLogger(mdcDisabled);
99+
}
83100
}

spt-development-logging-spring-boot-autoconfigure/src/test/java/com/spt/development/logging/spring/boot/autoconfigure/LoggingSpringAutoConfigurationTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.spt.development.logging.spring.boot.autoconfigure;
22

3+
import com.spt.development.logging.spring.DaoSupportLogger;
34
import com.spt.development.logging.spring.JmsListenerLogger;
45
import com.spt.development.logging.spring.RepositoryLogger;
56
import com.spt.development.logging.spring.RestControllerLogger;
67
import com.spt.development.logging.spring.ServiceLogger;
78
import org.junit.jupiter.api.AfterEach;
89
import org.junit.jupiter.api.BeforeEach;
910
import org.junit.jupiter.api.Test;
11+
import org.springframework.boot.test.util.TestPropertyValues;
1012
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
1113

1214
import static org.hamcrest.CoreMatchers.is;
@@ -30,12 +32,17 @@ void closeContext() {
3032

3133
@Test
3234
void register_happyPath_shouldRegisterLoggers() {
35+
TestPropertyValues.of(
36+
"spt.logging.dao-support.enabled:true"
37+
).applyTo(context);
38+
3339
context.register(LoggingSpringAutoConfiguration.class);
3440
context.refresh();
3541

3642
assertThat(context.getBean(RestControllerLogger.class), is(notNullValue()));
3743
assertThat(context.getBean(JmsListenerLogger.class), is(notNullValue()));
3844
assertThat(context.getBean(ServiceLogger.class), is(notNullValue()));
3945
assertThat(context.getBean(RepositoryLogger.class), is(notNullValue()));
46+
assertThat(context.getBean(DaoSupportLogger.class), is(notNullValue()));
4047
}
4148
}

0 commit comments

Comments
 (0)