这是build.gradle文件。我删除了评论和敏感数据。 仍然收到"缺少EmbeddedServletContainerFactory Bean"错误。
buildscript {
ext {
springBootVersion = '1.5.9.RELEASE'
}
repositories {
jcenter()
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://plugins.gradle.org" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-
plugin:${springBootVersion}")
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.5.4")
classpath("gradle.plugin.de.gliderpilot.gradle.semantic-
release:gradle-semantic-release-plugin:1.3.1")
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-jdbc')
compile('org.springframework.boot:spring-boot-starter-mail')
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
{
exclude module: 'spring-boot-starter-tomcat'
}
runtime files ('/libs/ojdbc8.jar')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
plugins {
id "org.sonarqube" version "2.5"
id "com.gorylenko.gradle-git-properties" version "1.4.17"
id "de.gliderpilot.semantic-release" version "1.3.1"
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'idea'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
sourceCompatibility = 1.8
group = 'com.usps.informed-delivery'
dependencies {
compile('org.springframework.boot:spring-boot-starter-activemq')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.boot:spring-boot-starter-aop')
compile('org.springframework.boot:spring-boot-starter-batch')
compile('org.springframework.boot:spring-boot-starter-cache')
compile('org.springframework.boot:spring-boot-starter-data-cassandra')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-redis')
compile('org.springframework.boot:spring-boot-starter-integration')
compile('org.springframework.batch:spring-batch-integration')
compile('org.springframework.integration:spring-integration-xml')
compile('org.springframework.integration:spring-integration-mail')
compile('org.springframework.integration:spring-integration-test')
compile('org.slf4j:slf4j-api')
compile('org.springframework.integration:spring-integration-java-dsl')
compile("org.springframework:spring-oxm")
compile("joda-time:joda-time")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
compile('org.liquibase:liquibase-core')
compile('libs/ojdbc8.jar')
runtime('org.springframework.boot:spring-boot-devtools')
runtime('com.h2database:h2')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.batch:spring-batch-test')
testCompile('org.springframework.integration:spring-integration-test')
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
artifactory {
contextUrl = 'http:whatever'
publish {
repository {
if (version.toString().endsWith("-SNAPSHOT")) {
repoKey = 'snapshots'
} else {
repoKey = 'releases'
}
username = ""
password = ""
}
defaults {
publications('mavenJava')
publishArtifacts = true
properties = ['qa.level': 'basic', 'dev.team': 'core']
publishPom = true
}
}
resolve {
repoKey = 'jcenter'
username = ""
password = ""
}
}
sonarqube {
properties {
property "sonar.sourceEncoding", "UTF-8"
property "sonar.projectKey", "readers-digest-generator"
property "sonar.projectName", "Readers Digest Generator"
}
}
按请求发布build.gradle文件。我试着通过推杆解决 aplication.properties文件中的spring.main.web-environment- = false和BatchApplication.java中的app.setWebEnvironment(false)
答案 0 :(得分:0)
Spring Boot假定它是一个Web应用程序,除非您另外配置它。文档(在此处https://docs.spring.io/spring-boot/docs/current/reference/html/howto-spring-boot-application.html#howto-create-a-non-web-application)说明您可以通过调用?
或通过设置属性SpringApplication#s setWebEnvironment(false)