-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INC-1064: update to DPS Gradle Plugin v5 which includes Spring Boot v3 and AWS SDK v2 #407
Changes from 2 commits
09fbba7
bbc1766
7e89347
35116d8
40dcce0
dd40859
be9b7a0
d0cd279
2950877
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
plugins { | ||
id("uk.gov.justice.hmpps.gradle-spring-boot") version "4.8.4" | ||
id("uk.gov.justice.hmpps.gradle-spring-boot") version "5.1.3" | ||
id("org.springdoc.openapi-gradle-plugin") version "1.6.0" | ||
id("jacoco") | ||
id("org.sonarqube") version "4.0.0.2929" | ||
|
@@ -17,14 +17,19 @@ configurations { | |
testImplementation { exclude(group = "org.junit.vintage") } | ||
} | ||
|
||
repositories { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
maven { url = uri("https://repo.spring.io/milestone") } | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("org.springframework.boot:spring-boot-starter-webflux") | ||
implementation("org.springframework.boot:spring-boot-starter-data-r2dbc") | ||
implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server") | ||
implementation("org.springframework.boot:spring-boot-starter-security") | ||
implementation("org.springframework.boot:spring-boot-starter-oauth2-client") | ||
|
||
implementation("uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter:1.2.0") | ||
implementation("uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter:2.0.0-beta-14") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upgrading this as it's compatible with Spring Boot v3 - see https://github.com/ministryofjustice/hmpps-spring-boot-sqs/blob/spring-boot-3/release-notes/2.0.0.md |
||
|
||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor") | ||
|
@@ -34,8 +39,7 @@ dependencies { | |
runtimeOnly("org.springframework.boot:spring-boot-starter-jdbc") | ||
runtimeOnly("org.postgresql:postgresql:42.6.0") | ||
|
||
implementation("org.springdoc:springdoc-openapi-webflux-ui:1.6.15") | ||
implementation("org.springdoc:springdoc-openapi-kotlin:1.6.15") | ||
implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.1.0") | ||
|
||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") | ||
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") | ||
|
@@ -51,15 +55,17 @@ dependencies { | |
developmentOnly("org.springframework.boot:spring-boot-devtools") | ||
|
||
testImplementation("org.awaitility:awaitility-kotlin") | ||
testImplementation("io.jsonwebtoken:jjwt:0.9.1") | ||
testImplementation("io.jsonwebtoken:jjwt-impl:0.11.5") | ||
testImplementation("io.jsonwebtoken:jjwt-jackson:0.11.5") | ||
testImplementation("org.mockito:mockito-inline") | ||
testImplementation("io.swagger.parser.v3:swagger-parser:2.1.13") | ||
testImplementation("org.springframework.security:spring-security-test") | ||
testImplementation("com.github.tomakehurst:wiremock-standalone:2.27.2") | ||
testImplementation("org.testcontainers:localstack:1.17.6") | ||
testImplementation("org.testcontainers:postgresql:1.17.6") | ||
testImplementation("com.github.tomakehurst:wiremock-jre8-standalone:2.35.0") | ||
testImplementation("org.testcontainers:localstack:1.18.0") | ||
testImplementation("org.testcontainers:postgresql:1.18.0") | ||
testImplementation("io.projectreactor:reactor-test") | ||
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test") | ||
testImplementation("javax.xml.bind:jaxb-api:2.3.1") | ||
|
||
if (project.hasProperty("docs")) { | ||
implementation("com.h2database:h2") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
package uk.gov.justice.digital.hmpps.incentivesapi.config | ||
|
||
import com.microsoft.applicationinsights.TelemetryClient | ||
import org.slf4j.LoggerFactory | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
/** | ||
* Application insights now controlled by the spring-boot-starter dependency. However when the key is not specified | ||
* we don't get a telemetry bean and application won't start. Therefore need this backup configuration. | ||
* TelemetryClient gets altered at runtime by the java agent and so is a no-op otherwise | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
*/ | ||
@Configuration | ||
class ApplicationInsightsConfiguration { | ||
@Bean | ||
@ConditionalOnExpression("T(org.apache.commons.lang3.StringUtils).isBlank('\${applicationinsights.connection.string:}')") | ||
fun telemetryClient(): TelemetryClient { | ||
log.warn("Application insights configuration missing, returning dummy bean instead") | ||
|
||
return TelemetryClient() | ||
} | ||
|
||
companion object { | ||
private val log = LoggerFactory.getLogger(this::class.java) | ||
} | ||
fun telemetryClient(): TelemetryClient = TelemetryClient() | ||
} | ||
|
||
fun TelemetryClient.trackEvent(name: String, properties: Map<String, String>) = this.trackEvent(name, properties, null) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import io.swagger.v3.oas.models.security.Scopes | |
import io.swagger.v3.oas.models.security.SecurityRequirement | ||
import io.swagger.v3.oas.models.security.SecurityScheme | ||
import io.swagger.v3.oas.models.servers.Server | ||
import org.springdoc.core.customizers.OpenApiCustomiser | ||
import org.springdoc.core.customizers.OpenApiCustomizer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😒 |
||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.boot.info.BuildProperties | ||
import org.springframework.context.annotation.Bean | ||
|
@@ -76,7 +76,7 @@ class OpenApiConfiguration( | |
} | ||
|
||
@Bean | ||
fun openAPICustomiser(): OpenApiCustomiser = OpenApiCustomiser { | ||
fun openAPICustomiser(): OpenApiCustomizer = OpenApiCustomizer { | ||
it.components.schemas.forEach { (_, schema: Schema<*>) -> | ||
val properties = schema.properties ?: mutableMapOf() | ||
for (propertyName in properties.keys) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import org.springframework.security.web.server.SecurityWebFilterChain | |
|
||
@Configuration | ||
@EnableWebFluxSecurity | ||
@EnableReactiveMethodSecurity | ||
@EnableReactiveMethodSecurity(useAuthorizationManager = false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
@EnableR2dbcRepositories | ||
class ResourceServerConfiguration { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package uk.gov.justice.digital.hmpps.incentivesapi.service | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import io.awspring.cloud.sqs.annotation.SqsListener | ||
import kotlinx.coroutines.runBlocking | ||
import org.slf4j.Logger | ||
import org.slf4j.LoggerFactory | ||
import org.springframework.jms.annotation.JmsListener | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
|
@@ -16,7 +16,7 @@ class PrisonOffenderEventListener( | |
val log: Logger = LoggerFactory.getLogger(this::class.java) | ||
} | ||
|
||
@JmsListener(destination = "incentives", containerFactory = "hmppsQueueContainerFactoryProxy") | ||
@SqsListener("incentives", factory = "hmppsQueueContainerFactoryProxy") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I spotted ministryofjustice/hmpps-prisoner-to-nomis-update#164 - which we could also include if folks think it would be helpful? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not a bad idea. maybe we can do that in a separate pr as there are probs other methods that would benefit with span annotations There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good shout - raised https://dsdmoj.atlassian.net/browse/INC-1198 |
||
fun onPrisonOffenderEvent(requestJson: String) = runBlocking { | ||
val (message, messageAttributes) = mapper.readValue(requestJson, HMPPSMessage::class.java) | ||
val eventType = messageAttributes.eventType.Value | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ class JwtAuthHelper { | |
.setSubject(subject) | ||
.addClaims(it.toMap()) | ||
.setExpiration(Date(System.currentTimeMillis() + expiryTime.toMillis())) | ||
.signWith(SignatureAlgorithm.RS256, keyPair.private) | ||
.signWith(keyPair.private, SignatureAlgorithm.RS256) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤣 |
||
.compact() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://dsdmoj.atlassian.net/browse/SDIT-367
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
microsoft/ApplicationInsights-Java#2870 (comment) – can’t tell if this is still required to throttle app insights logging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot! Removed with be9b7a0