Skip to content
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

Suggestion on improved local development #65

Open
elg-entur opened this issue Jan 2, 2025 · 0 comments
Open

Suggestion on improved local development #65

elg-entur opened this issue Jan 2, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@elg-entur
Copy link

elg-entur commented Jan 2, 2025

Currently the Running applications locally section in the web-guide suggest adding test-dependencies to the production scope. This will also add them to the main scope when building a jar.

Here is an updated suggestion for 3.0.1. it only adds the dependencies when running locally, not e.g., with bootJar. Additionally, will this work if you are running as a spring boot profile in intellij

dependencies{
    // Setup HumanReadableJsonApplicationListener without reflection
    compileOnly("no.entur.logging.cloud:test-logback") { transitive = false }
}

tasks.register("logPlainly") {
    dependencies {
        implementation("no.entur.logging.cloud:request-response-spring-boot-starter-gcp-web-test")
        implementation("no.entur.logging.cloud:spring-boot-starter-gcp-web-test")
    }
}

tasks.withType(JavaExec).configureEach {
    dependsOn("logPlainly")
}

This will mean that the HumanReadableJsonApplicationListener must be updated to use ConditionalOnClass

package org.entur.offers.config.logging

import org.springframework.boot.autoconfigure.condition.{ConditionalOnClass, ConditionalOnProperty}
import org.springframework.context.ApplicationListener
import org.springframework.context.event.ContextRefreshedEvent
import org.springframework.stereotype.Component

@Component
@ConditionalOnClass(name = Array("no.entur.logging.cloud.logback.logstash.test.CompositeConsoleOutputControl"))
class HumanReadableJsonApplicationListener extends ApplicationListener[ContextRefreshedEvent] {
  def onApplicationEvent(event: ContextRefreshedEvent): Unit = {
    no.entur.logging.cloud.logback.logstash.test.CompositeConsoleOutputControl.useHumanReadableJsonEncoder()
  }
}
@skjolber skjolber self-assigned this Jan 6, 2025
@skjolber skjolber added the enhancement New feature or request label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants