无法使用IntelliJ启动Spring Boot应用程序

时间:2016-07-26 15:22:18

标签: spring-mvc tomcat spring-boot

所以我通常使用Eclipse进行Spring Boot设置,它运行得很好。最近,我尝试了很多次但是无法在IntelliJ上运行Spring Boot项目。会发生什么是应用程序启动并自动停止。 我的gradle.build如下



        buildscript {
        ext {
            springBootVersion = '1.3.6.RELEASE'
        }
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        }
    }

    apply plugin: 'groovy'
    apply plugin: 'eclipse-wtp'
    apply plugin: 'spring-boot'
    apply plugin: 'war'


    war {
        baseName = 'demo12'
        version = '0.0.1-SNAPSHOT'
    }
    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    repositories {
        mavenCentral()
    }

    configurations {
        providedRuntime
    }

    dependencies {

        compile group: 'org.spockframework', name: 'spock-spring', version: '1.0-groovy-2.4'
        compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
        compile group: 'com.google.guava', name: 'guava', version: '19.0'


        compile('org.springframework.boot:spring-boot-starter-actuator')
        compile('org.springframework.boot:spring-boot-actuator-docs')
        compile('org.springframework.boot:spring-boot-starter-cache')
        compile('org.springframework.boot:spring-boot-starter-data-jpa')
        compile('org.springframework.boot:spring-boot-devtools')
        compile('org.springframework.boot:spring-boot-starter-security')
        compile('org.springframework.boot:spring-boot-starter-thymeleaf')
        compile('org.springframework.boot:spring-boot-starter-web')
        compile('org.codehaus.groovy:groovy')
        runtime('com.h2database:h2')
        runtime('mysql:mysql-connector-java')

        providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
        testCompile('org.springframework.boot:spring-boot-starter-test')
    }


    eclipse {
        classpath {
             containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
             containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
        }
    }

当应用程序启动时,以下内容直接从控制台输出:



  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.6.RELEASE)

2016-07-26 20:50:28.268  INFO 13779 --- [  restartedMain] com.example.Demo12Application            : Starting Demo12Application on Ankushs-MacBook-Pro.local with PID 13779 (/Users/Ankush/Downloads/intellij/demo12/build/classes/main started by Ankush in /Users/Ankush/Downloads/intellij/demo12)
2016-07-26 20:50:28.284  INFO 13779 --- [  restartedMain] com.example.Demo12Application            : The following profiles are active: dev
2016-07-26 20:50:28.497  INFO 13779 --- [  restartedMain] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1c2a25de: startup date [Tue Jul 26 20:50:28 IST 2016]; root of context hierarchy
2016-07-26 20:50:31.463  INFO 13779 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-07-26 20:50:31.495  INFO 13779 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2016-07-26 20:50:31.586  INFO 13779 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate Core {4.3.11.Final}
2016-07-26 20:50:31.588  INFO 13779 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2016-07-26 20:50:31.591  INFO 13779 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2016-07-26 20:50:31.807  INFO 13779 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2016-07-26 20:50:32.077  INFO 13779 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2016-07-26 20:50:32.166  INFO 13779 --- [  restartedMain] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
2016-07-26 20:50:32.295  INFO 13779 --- [  restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2016-07-26 20:50:32.299  INFO 13779 --- [  restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete
2016-07-26 20:50:33.880  INFO 13779 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2016-07-26 20:50:33.941  INFO 13779 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-07-26 20:50:33.953  INFO 13779 --- [  restartedMain] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2016-07-26 20:50:34.070  INFO 13779 --- [  restartedMain] com.example.Demo12Application            : Started Demo12Application in 6.649 seconds (JVM running for 8.064)
2016-07-26 20:50:34.073  INFO 13779 --- [       Thread-8] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1c2a25de: startup date [Tue Jul 26 20:50:28 IST 2016]; root of context hierarchy
2016-07-26 20:50:34.076  INFO 13779 --- [       Thread-8] o.s.c.support.DefaultLifecycleProcessor  : Stopping beans in phase 0
2016-07-26 20:50:34.084  INFO 13779 --- [       Thread-8] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2016-07-26 20:50:34.085  INFO 13779 --- [       Thread-8] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2016-07-26 20:50:34.086  INFO 13779 --- [       Thread-8] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2016-07-26 20:50:34.087  INFO 13779 --- [       Thread-8] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete

Process finished with exit code 0

我一直试图切换到IntelliJ几个月,但由于某种原因,这个废话每次出现。任何帮助将非常感激。谢谢。

0 个答案:

没有答案