Generate generated folder when starting springboot netty - java

I am studying spring webflux, but the generated folder is created when the server starts. Do you know why?
If you restart the server after deleting the generated folder, it will be created again.
The build.gradle file was configured as follows.
spring boot 2.2.7.RELEASE version and using jdk 8.
build.gradle
buildscript {
ext {
restDocsVersion = "2.0.2.RELEASE"
}
dependencies {
classpath "org.asciidoctor:asciidoctor-gradle-plugin:1.5.3"
}
}
plugins {
id "org.springframework.boot" version "2.2.7.RELEASE"
id "io.spring.dependency-management" version "1.0.9.RELEASE"
id "java"
id "groovy"
id "org.asciidoctor.convert" version "2.4.0"
}
ext {
snippetsDir = file("build/generated-snippets")
}
test {
useJUnitPlatform()
}
asciidoctor {
inputs.dir snippetsDir
dependsOn test
}
bootJar {
dependsOn asciidoctor
from("${asciidoctor.outputDir}/html5") {
into "static/docs"
}
dependsOn "copyDocs"
}
task copyDocs(type: Copy) {
from "${asciidoctor.outputDir}/html5"
into "src/main/resources/static/docs"
}
group = "com.example"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
build {
dependsOn clean
}
repositories {
mavenCentral()
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-aop"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-webflux"
compile "org.springframework.boot:spring-boot-starter-data-redis-reactive"
compileOnly "org.projectlombok:lombok"
annotationProcessor "org.projectlombok:lombok"
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude group: "org.junit.vintage", module: "junit-vintage-engine"
}
testImplementation "io.projectreactor:reactor-test"
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
compile group: "com.fasterxml.jackson.core", name: "jackson-core", version: "2.9.8"
compile group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: "2.9.8"
compile group: "com.fasterxml.jackson.core", name: "jackson-databind", version: "2.9.8"
compile group: "com.googlecode.json-simple", name: "json-simple", version: "1.1.1"
asciidoctor "org.springframework.restdocs:spring-restdocs-asciidoctor:${restDocsVersion}"
testCompile "org.springframework.restdocs:spring-restdocs-webtestclient:${restDocsVersion}"
compile group: "org.codehaus.groovy", name: "groovy-all", version: "2.5.8"
}

Related

Gradle Spring Boot Junit | Logging | Debugging

I am introducing Junit tests in one of our projects but unfortunately am getting a null pointer exception but I can't tell where is it thrown, when trying to debug the debugger does not stop in my break point. I am testing a spring boot application
Can you assist I am not familiar with gradle maybe I missed a certain config, below is my gradle file
buildscript {
ext {
springBootVersion = '2.2.11.RELEASE'
}
repositories {
mavenCentral()
maven {
url "https://artifacts.company.com/artifactory/appsmav-main-maven-local/"
credentials {
username "${artifactory_user}"
password "${artifactory_password}"
}
}
maven {
url "https://plugins.gradle.org/m2/"
}
// flatDir {
// dirs '/Users/pabu/workspaces/intellij/companyikat7/PlantumlPlugin/build/libs'
// }
}
repositories { flatDir name: 'libs', dirs: "../build/libs" }
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-RC3'
classpath 'org.reflections:reflections:0.9.11'
classpath 'io.company.gradle.plugins:PlantumlPlugin:1.0.7'
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.4"
classpath "gradle.plugin.com.github.viswaramamoorthy:gradle-util-plugins:0.1.0-RELEASE"
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'io.company.gradle.plugins.plantuml'
apply plugin: 'com.gorylenko.gradle-git-properties'
apply plugin: "com.github.ManifestClasspath"
group = 'io.company'
version = '0.0.2'
sourceCompatibility = "11"
repositories {
jcenter()
mavenCentral()
maven {
url "https://artifacts.company.com/artifactory/appsmav-main-maven-local/"
credentials {
username "${artifactory_user}"
password "${artifactory_password}"
}
}
}
springBoot {
buildInfo {
properties {
artifact = 'company-core-service'
name = 'company'
}
}
}
configurations {
providedRuntime
compile.exclude module: 'slf4j-simple'
compile.exclude module: "spring-boot-starter-tomcat"
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-jersey')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-jetty')
compileOnly('org.springframework.boot:spring-boot-devtools')
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-freemarker
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-freemarker', version: '2.5.3'
implementation 'io.micrometer:micrometer-core:1.5.7'
implementation 'io.micrometer:micrometer-registry-prometheus:1.5.7'
implementation 'io.sentry:sentry-spring-boot-starter:3.2.0'
implementation 'io.sentry:sentry-logback:3.2.0'
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.8.0'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.8.0'
compile group: 'com.unboundid', name: 'unboundid-ldapsdk', version: '4.0.0'
runtime('org.postgresql:postgresql')
compile('io.company.commons:commons-utils:1.+') {
exclude group: 'org.slf4j'
}
compile('io.company.commons:commons-api:1.3.0') {
exclude group: 'org.slf4j'
}
// https://mvnrepository.com/artifact/org.springframework.retry/spring-retry
compile group: 'org.springframework.retry', name: 'spring-retry', version: '1.3.0'
// Azure Notification Hub SDK
compile group: 'com.windowsazure', name: 'Notification-Hubs-java-sdk', version: '0.1.0'
// https://mvnrepository.com/artifact/javax.json/javax.json-api
compile group: 'javax.json', name: 'javax.json-api', version: '1.1.4'
// https://mvnrepository.com/artifact/org.glassfish/javax.json
compile group: 'org.glassfish', name: 'javax.json', version: '1.1.4'
implementation 'com.sun.mail:javax.mail:1.6.2'
// compile project(":commons-api-local")
compile('io.company.commons:commons-io:1.3.0') {
exclude group: 'org.slf4j'
}
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'io.company.commons', name: 'commons-jwt', version: '1.0.8'
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.security:spring-security-test')
// https://projectlombok.org
compileOnly 'org.projectlombok:lombok:1.18.4'
annotationProcessor 'org.projectlombok:lombok:1.18.4'
testImplementation('org.junit.jupiter:junit-jupiter:5.5.1')
}
test {
useJUnitPlatform {
excludeTags "integration"
}
testLogging.showStandardStreams(true);
testLogging {
events "passed", "skipped", "failed"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
}
}
In the log below I can't tell where is the NullPointerException thrown
16:38:55.075 [main] DEBUG org.springframework.ui.freemarker.SpringTemplateLoader - Looking for FreeMarker template with name [DisruptionOverviewBody_en.ftlh]
16:38:55.076 [main] DEBUG org.springframework.ui.freemarker.SpringTemplateLoader - Looking for FreeMarker template with name [DisruptionOverviewBody.ftlh]
Failures (1):
JUnit Jupiter:DisruptionEventControllerTest:shouldCreateNewDisruptionEvent()
MethodSource [className = 'ui.controller.DisruptionEventControllerTest', methodName = 'shouldCreateNewDisruptionEvent', methodParameterTypes = '']
=> java.lang.NullPointerException
Test run finished after 1639 ms

I have an error but dependencies include in gradle root and gradle module config, why?

I have root config gradle.build
plugins {
id 'org.springframework.boot' version '2.3.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
id 'idea'
}
idea {
project {
languageLevel = 14
}
module {
downloadJavadoc = true
downloadSources = true
}
}
allprojects {
group "ru.otus"
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}
apply plugin: "io.spring.dependency-management"
dependencyManagement {
dependencies {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:2.3.5.RELEASE")
}
dependency("org.projectlombok:lombok:1.18.16")
dependency("org.springframework.shell:spring-shell-starter:2.0.1.RELEASE")
dependency("org.springframework.boot:spring-boot-starter-data-jpa:2.3.5.RELEASE")
dependency("org.flywaydb:flyway-core:6.4.4")
dependency("org.postgresql:postgresql:42.2.16")
dependency("org.hamcrest:hamcrest-core:1.3")
dependency("org.springframework.boot:spring-boot-starter-test:2.3.5.RELEASE")
}
}
configurations.all {
resolutionStrategy {
failOnVersionConflict()
}
resolutionStrategy {
force("javax.servlet:servlet-api:2.4")
force("commons-logging:commons-logging:1.1.1")
force("commons-lang:commons-lang:2.5")
force("org.codehaus.jackson:jackson-core-asl:1.8.8")
force("org.codehaus.jackson:jackson-mapper-asl:1.8.3")
force("org.codehaus.jettison:jettison:1.1")
force("org.javassist:javassist:3.24.0-GA")
force("org.apiguardian:apiguardian-api:1.1.0")
force("org.opentest4j:opentest4j:1.2.0")
}
}
}
and have build.gradle in module
plugins {
id 'java'
}
version = '0.0.1-SNAPSHOT'
dependencies {
implementation group: 'org.springframework.shell', name: 'spring-shell-starter', version: '2.0.1.RELEASE'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter', version: '2.3.5.RELEASE'
implementation group: 'org.flywaydb', name: 'flyway-core', version: '6.4.4'
testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.3.5.RELEASE'
}
After download dependencies and add in models annotations like #Entity, #Table #Id and etc. i have an error: cannot find symbol
#Entity
^
symbol: class Entity
But i have spring-boot-starter-jpa in dependencies, i don't know why in module i can't use dependencies.
With dependencyManagement you only manage dependencies like version, overrides etc. you don't actually add dependencies to a project. For that use dependencies like you use in the other places.

Build Gradle Local Dependency

How do you declare a local dependency for gradle 4.10.3 to not use the github project and use your own custom build of the project? Open source project I'm trying to compile https://github.com/kami-blue/client
My build is at /Users/macbook/Desktop/baritone-master/dist/baritone-api-1.2.14.jar
I've tried changing the file path to it and commenting out the two compile commands but that didn't work.
//compile 'com.github.cabaletta:baritone:1.2.14'
//compile 'cabaletta:baritone-api:1.2'
include(dependency('/Users/macbook/Desktop/baritone-master/dist/baritone-api-1.2.14.jar'))
Using these either of these two methods do not work either:
implementation files('/Users/macbook/Desktop/baritone-master/dist/baritone-api-1.2.14.jar')
compile fileTree(dir: '/Users/macbook/Desktop/baritone-master/dist', include: ['*.jar'])
build.gradle file:
buildscript {
repositories {
jcenter()
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name = 'SpongePowered'
url = 'http://repo.spongepowered.org/maven'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.3'
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: "${kotlin_version}" }
}
apply plugin: 'kotlin'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'
version project.modVersion
group project.modGroup // http://maven.apache.org/guides/mini/guide-naming-conventions.html
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = project.forgeVersion
runDir = 'run'
mappings = project.mcpVersion
coreMod = 'me.zeroeightsix.kami.mixin.MixinLoaderForge'
makeObfSourceJar = false
}
repositories {
maven {
name = 'spongepowered-repo'
url = 'http://repo.spongepowered.org/maven/'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
maven {
name = 'swt-repo'
url = "http://maven-eclipse.github.io/maven"
}
maven {
name = "jitpack.io"
url = "https://jitpack.io"
}
maven {
name = "forgelin-repo"
url "http://maven.shadowfacts.net/"
}
mavenCentral()
jcenter()
}
dependencies {
// mixin needs to be distributed with the mod, very important
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { // do NOT update this to 8.0 or above, it breaks compatibility with future client
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core' // we want to exclude this as well because 0.7.11 includes it too new for MC
}
compile "com.github.ZeroMemes:Alpine:1.7"
compile group: 'net.jodah', name: 'typetools', version: '0.6.2'
compile group: 'org.yaml', name: 'snakeyaml', version: '1.26'
compile(group: 'org.reflections', name: 'reflections', version: '0.9.12') {
exclude group: 'com.google.guava', module: 'guava'
}
compile 'club.minnced:java-discord-rpc:2.0.2'
compile 'com.github.MrPowerGamerBR:TemmieWebhook:-SNAPSHOT'
compile 'com.github.kevinsawicki:http-request:http-request-6.0'
compile 'com.github.cabaletta:baritone:1.2.14'
compile 'cabaletta:baritone-api:1.2'
compile group: "net.shadowfacts", name: "Forgelin", version: "1.8.4"
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk7", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: kotlin_version
compile group: "org.jetbrains", name: "annotations", version: annotations_version
compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-core", version: coroutines_version
compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-jdk8", version: coroutines_version
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property 'version', project.version
inputs.property 'mcversion', project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
// move _at.cfg into META-INF
rename '(.+_at.cfg)', 'META-INF/$1'
}
shadowJar {
dependencies {
include(dependency('org.spongepowered:mixin'))
include(dependency('com.github.ZeroMemes:Alpine'))
include(dependency('club.minnced:java-discord-rpc'))
include(dependency('net.jodah:typetools'))
include(dependency('org.yaml:snakeyaml'))
include(dependency('org.reflections:reflections'))
include(dependency('org.javassist:javassist'))
include(dependency('com.github.MrPowerGamerBR:TemmieWebhook'))
include(dependency('com.github.kevinsawicki:http-request'))
include(dependency('cabaletta:baritone-api'))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"))
include(dependency("org.jetbrains:annotations:${annotations_version}"))
include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutines_version}"))
include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${coroutines_version}"))
include(dependency('net.shadowfacts:Forgelin'))
}
exclude 'dummyThing' // can someone explain why this is here
classifier = 'release'
}
mixin {
defaultObfuscationEnv searge
add sourceSets.main, 'mixins.kami.refmap.json'
}
reobf {
shadowJar {
mappingType = 'SEARGE'
classpath = sourceSets.main.compileClasspath
}
}
// Don't put baritone mixin here please c:
jar {
manifest {
attributes(
'MixinConfigs': 'mixins.kami.json',
'tweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': 0,
'FMLCorePluginContainsFMLMod': 'true',
'FMLCorePlugin': 'me.zeroeightsix.kami.mixin.MixinLoaderForge',
'ForceLoadAsMod': 'true',
'FMLAT': 'kami_at.cfg'
)
}
}
build.dependsOn(shadowJar)
Please try this. Should fix your problem.
In this case gradle will try to use a relative path for a local jar dependency.
Read those documentaries for more information
dependencies {
implementation files('/Users/macbook/Desktop/baritone-master/dist/baritone-api-1.2.14.jar')
}
Additionally you can add all jars in X directory.
dependencies {
compile fileTree(dir: 'yourDirection', include: ['*.jar'])
}

My gradle spring project on intellij taking too long to refresh

I am using Intellij IDEA 2017.1.4. I am new to gradle. I have been given a multi modular spring project on Gradle. Problem is when I do "Refresh all gradle projects" (on the side pan of IDEA), it takes hours. Some times a day. It is necessary for me sometimes doing refresh due to addition of dependencies or something else.
Following is my root build.gradle file. Please help.
group 'tv.videoready'
version = "1.0.0-RELEASE"
description = "Mobile/Web API's Application"
buildscript {
ext {
springBootVersion = '1.4.0.RELEASE'
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.17")
}
}
apply plugin: 'idea'
apply plugin: "com.gorylenko.gradle-git-properties"
jar {
baseName = 'rest-api'
version = '1.0.0-RELEASE'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url 'http://artifactory.videoready.tv/artifactory/libs-release-local' }
maven { url 'http://artifactory.videoready.tv/artifactory/libs-snapshot-local' }
}
gitProperties {
dateFormat = "d MMM yyyy HH:mm:ss Z"
dateFormatTimeZone = "UTC"
gitRepositoryRoot = new File("${project.rootDir}")
gitPropertiesDir = new File("${project.rootDir}/src/main/resources")
}
ext {
springBootVersion = "1.4.0.RELEASE"
mysqlConnectorVersion = '5.1.39'
swaggerVersion = '2.7.0'
}
dependencies {
// Actuator
compile("org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}")
compile 'org.springframework.hateoas:spring-hateoas:0.20.0.RELEASE'
compile project(":login")
compile project(":config")
compile project(":device")
compile project(":password")
compile project(":sms")
compile project(":remote-record")
compile project(":otp")
compile project(":profile")
compile("de.codecentric:spring-boot-admin-starter-client:1.4.4")
}
allprojects {
apply plugin: 'java'
apply plugin: 'spring-boot'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url 'http://artifactory.videoready.tv/artifactory/libs-release-local' }
maven { url 'http://artifactory.videoready.tv/artifactory/libs-snapshot-local' }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-jetty:${springBootVersion}")
compile("org.springframework.boot:spring-boot-starter-amqp:${springBootVersion}")
compile("mysql:mysql-connector-java:${mysqlConnectorVersion}")
compile group: 'org.hibernate', name: 'hibernate-validator', version: '4.3.2.Final'
//HTTP Client
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.5'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'
compile(group: 'tv.videoready', name: 'module-logger', version: '2.0.2-RELEASE')
compile(group: 'tv.videoready', name: 'cors-filter', version: '1.0.0')
// compile(group: 'tv.videoready', name: 'common-sql-domains', version: '1.5.8-SNAPSHOT')
compile files("/home/divya/projects/tatasky/common-services/common-sql-domains/build/libs/ common-sql-domains-3.1.0-RELEASE.jar")
compile(group: 'tv.videoready', name: 'mm-domains', version: '3.1.4-SNAPSHOT')
compile(group: 'tv.videoready', name: 'common-constants', version: '1.4.10-SNAPSHOT')
compile(group: 'tv.videoready', name: 'domain-pojo-utils', version: '1.2.0-SNAPSHOT')
compile(group: 'tv.videoready', name: 'validation-util', version: '1.2.0-SNAPSHOT')
compile(group: 'tv.videoready', name: 'search-client', version: '1.4.4-SNAPSHOT'){
exclude(group: 'tv.videoready', module: 'common-constants')
exclude(group: 'tv.videoready', module: 'common-sql-domains')
exclude(group: 'tv.videoready', module: 'mm-domains')
}
compile(group: 'tv.videoready', name: 'common-pojo', version: '1.3.23-SNAPSHOT')
compile(group: 'tv.videoready', name: 'i-spy-client', version: '1.0.2-SNAPSHOT')
compile(group: 'tv.videoready', name: 'cache', version: '2.0.26-SNAPSHOT')
compile('com.hazelcast:hazelcast:3.7.5')
compile('com.hazelcast:hazelcast-client:3.7.5')
compile("io.springfox:springfox-swagger2:${swaggerVersion}")
compile("io.springfox:springfox-swagger-ui:${swaggerVersion}")
}
configurations {
compile.exclude module: ("spring-boot-starter-tomcat")
compile.exclude module: ("spring-boot-starter-logging")
}
sourceSets.main.resources {
srcDir '../src/main/resources'
}
}
subprojects {
group = 'tv.videoready'
version = '1.0.0-RELEASE'
}
processResources {
filesMatching("**/application.properties") {
expand(project.properties)
}
}
bootRun {
systemProperties = System.properties
systemProperty "log4j.configurationFactory", "tv.videoready.logger.LoggingConfigurationFactory"
systemProperty "mockRRM", true
systemProperty "dev.hazelcast.setup.enabled", "false"
systemProperty "dev.hazelcast.cluster.group.password", "hari"
systemProperty "hazelcast.cluster.group.password", "hari"
systemProperty "spring.config.location", "classpath:hazelcast-dev.properties"
systemProperty "jsse.enableSNIExtension", "false"
}

Running Spring Boot Application on WebSphere 9

I've a Spring Boot Application with main class:
#SpringBootApplication
public class MyApplication extends SpringBootServletInitializer{
public static void main(String[] args) {
SpringApplication.run(MyApplication .class, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application){
return application.sources(applicationClass);
}
private static Class<MyApplication > applicationClass = MyApplication .class;
}
With gradle.build:
version '1.0'
// dependencies for command line
buildscript {
ext {
springBootVersion = '1.4.3.RELEASE'
dependencyManagementVersion = '0.6.0.RELEASE'
}
repositories {
jcenter()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "io.spring.gradle:dependency-management-plugin:${dependencyManagementVersion}"
}
}
apply plugin: "io.spring.dependency-management"
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'idea'
// JDK 8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
jcenter()
}
ext {
springCloudVersion = 'Brixton.SR4'
springBootVersion = '1.4.3.RELEASE'
swaggerVersion = '2.4.0'
jodaTimeVersion = '2.9.4'
jacksonJodaVersion = '2.5.1'
junitVersion = '4.12'
springWsTestVersion = '2.2.3.RELEASE'
lombokVersion = '1.16.10'
jsonPathVersion = '2.2.0'
ehcacheVersion = '3.2.0'
javaxCacheVersion = '1.0.0'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
}
}
sourceSets {
test {
java {
srcDir 'src/test/unit/java'
}
resources {
srcDir 'src/test/unit/resources'
}
}
}
tasks.withType(JavaExec) {
if (System.getProperty("DEBUG", 'false') == 'true') {
jvmArgs '-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006'
}
}
dependencies {
// https://mvnrepository.com/artifact/javax/javaee-api
compile group: 'javax', name: 'javaee-api', version: '7.0'
/* core libraries */
compile('org.springframework.cloud:spring-cloud-starter-config') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compile('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compile("org.springframework.boot:spring-boot-starter-hateoas"){
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compile 'org.springframework.ws:spring-ws-core'
// tag::actuator[]; for #RefreshScope
compile("org.springframework.boot:spring-boot-starter-actuator"){
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
// end::actuator[]
// logging
compile('org.springframework.boot:spring-boot-starter-log4j2')
compile('com.fasterxml.jackson.dataformat:jackson-dataformat-yaml')
compile('com.fasterxml.jackson.core:jackson-databind')
// embedded server
providedRuntime ('org.springframework.boot:spring-boot-starter-tomcat')
// https://mvnrepository.com/artifact/org.projectlombok/lombok-maven
compile "org.projectlombok:lombok:${lombokVersion}"
// https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path
// A Java DSL for reading JSON documents
compile "com.jayway.jsonpath:json-path:${jsonPathVersion}"
//for EhCache
// https://mvnrepository.com/artifact/org.ehcache/ehcache
compile "org.ehcache:ehcache:${ehcacheVersion}"
// https://mvnrepository.com/artifact/javax.cache/cache-api
compile "javax.cache:cache-api:${javaxCacheVersion}"
// utilities
compile "io.springfox:springfox-swagger2:${swaggerVersion}"
compile "io.springfox:springfox-swagger-ui:${swaggerVersion}"
compile "joda-time:joda-time:${jodaTimeVersion}"
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:${jacksonJodaVersion}"
compile ("org.springframework.boot:spring-boot-starter-aop") {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}
compile "org.aspectj:aspectjweaver:1.8.8"
/* plugins */
/* test libraries */
// unit
testCompile "junit:junit:${junitVersion}"
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "org.springframework.ws:spring-ws-test:${springWsTestVersion}"
}
war {
archiveName = "${project.name}.war"
manifest {
attributes 'Main-Class': 'com..content.MyApplication'
}
}
When I try to deploy the war file on WebSphere Application Server 9.0 Traditional, it starts but takes very long time. Without war file, server starts and stops very normally, but with application, server hangs.
Am I missing something?
Thank you for help!!
The startup delay is probably caused by CDI's implicit bean archive scanning. If you are not using CDI, you can disable implicit bean archives with com.ibm.ws.cdi.enableImplicitBeanArchives=false.
You can find a much more detailed explanation in this tech note:
Custom Properties for improving application startup in WebSphere Application Server

Categories