首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法启动EmbeddedWebApplicationContext -不是web应用程序

无法启动EmbeddedWebApplicationContext -不是web应用程序
EN

Stack Overflow用户
提问于 2017-12-19 02:34:28
回答 1查看 120关注 0票数 0

这是build.gradle文件。我已经删除了评论和敏感数据。仍然收到"missing EmbeddedServletContainerFactory Bean“错误。

代码语言:javascript
复制
    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)来解决此问题

EN

回答 1

Stack Overflow用户

发布于 2017-12-19 04:51:42

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)或设置属性spring.main.web-environment=false,以编程方式将应用程序配置为不是web应用程序

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47874430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档