我需要在一个使用shedlock的微服务项目中更新spring-boot的次要版本。
如果spring-boot是在2.0.x版本上运行,那么它可以正常工作,但如果我将其升级到2.1.x,则maven build将中断对应用程序的测试,并给出此输出。
java.lang.AbstractMethodError: org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType(Ljava/lang/Class;)Z
at org.springframework.context.event.GenericApplicationListenerAdapter.supportsSourceType(GenericApplicationListenerAdapter.java:81)
at org.springframework.context.event.AbstractApplicationEventMulticaster.supportsEvent(AbstractApplicationEventMulticaster.java:294)
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:224)
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:195)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:347)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:306)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Maven依赖树是:
I.B.L:OAA:WAR:0.0.8-释放
+-i.b.l:domain:jar:0.0.6-快照:compile-com.fasterxml.jackson.dataType:jackson-datatype-jsr310:jar:2.9.7:compile+-com.fasterxml.jackson.core:jackson-注释:jar:2.9.0:compile
-com.fasterxml.jackson.core:jackson-databind:jar:2.9.7:compile
+-org.springframework.boot:spring-boot-starter:jar:2.1.1发行版:compile+-org.springframework.boot:spring-boot:jar:2.1.1发行版:compile
+-org.springframework.boot:spring-boot-autocconfigure:jar:2.1.1发行版:compile
+-org.springframework:jar:2.1.1发行版:compile+-javax.annotation-api:jar:1.3.2:compile
+-org.springframework:
+-com.oracle:ojdbc6:jar:11.2.0:compile
+-org.springframework.boot:spring-boot-starter-web:jar:2.1.1发行版:compile+-org.springframework.boot:spring-boot-starter-json:jar:2.1.1发行版:compile+-org.springframework.jar:2.1.1发行版:compile+-org.springframework.jar:2.1.1发行版:compile+-org.springframework.jar:2.1.1发行版:compile
+-org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.1版本:提供+-org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.13:提供
+-org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.13:提供
-org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.13:提供
+-org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.1发行版:compile+-com.zaxxer:hikaricp:jar:3.2.0:compile
-org.springframework:spring-jdbc:jar:5.1.3发行版:compile
-org.springframework:spring-tx:jar:5.1.3发行版:compile
+-org.springframework.boot:spring-boot-starter-acture:jar:2.1.1发行版:编译+-org.springframework.boot:spring-boot-acture-autocigure:jar:2.1.1发行版:编译-org.springframework.boot:spring-boot-acture:jar:2.1.1发行版:编译-io.micrometer:micrometer-core:jar:1.1.1:编译
+-org.hdr直方图:hdr直方图:jar:2.1.9:编译
+-org.springframework.boot:spring-boot-starter-test:jar:2.1.1发行版:compile
+-org.springframework.boot:spring-boot-test:jar:2.1.1发行版:compile
+-org.springframework.boot:spring-boot-test-autocconfigure:jar:2.1.1发行版:compile+-com.jayway.jsonpath:json-path:jar:2.4.0:compile
-net.minidev:json-smart:jar:2.3:compile
+-org.springframework.boot:spring-boot-starter-log4j2:jar:2.1.1.release:compile+-org.apache.logging.log4j:log4j-SLF4j-impl:jar:2.11.1:compile
-org.apache.logging.log4j:log4j-api:jar:2.11.1:compile
+-org.apache.logging.log4j:log4j-core:jar:2.11.1:compile
+-org.apache.httpcomponents:httpclient:jar:4.5.6:compile+-commons-logging:commons-logging:jar:1.2:compile
-commons-codec:commons-codec:jar:1.10:compile
+-org.apache.httpcomponents:httpcore:jar:4.4.10:compile
+-com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.9.7:compile-com.fasterxml.jackson.core:jackson-core:jar:2.9.7:compile-com.fasterxml.jackson.core
+-io.springfox:springfox-swagger2:jar:2.9.2:编译+-io.swagger:swagger-annotations:jar:1.5.20:编译
+-io.swagger:swagger-models:jar:1.5.20:编译
+-io.springfox:springfox-spi:jar:2.9.2:编译
-io.springfox:springfox-core:jar:2.9.2:编译
+-io.springfox:springfox-schema:jar:2.9.2:编译
+-io.springfox:springfox-swagger-ui:jar:2.9.2:编译
+-org.projectlombok:lombok:jar:1.18.4:编译
+-org.apache.commons:commons-lang3:jar:3.8.1:编译
+-com.h2database:h2:jar:1.4.197:编译
+-org.springframework.boot:spring-boot-starter-data-jpa:jar:2.1.1发行版:编译+-org.springframework.boot:spring数据:spring-data-jpa:jar:2.1.3发行版:compile
+-org.SpringFramework.data:spring-data-commons:jar:2.1.3发行版:compile-org.SpringFramework:spring-orm:jar:5.1.3发行版:compile
-org.SpringFramework:spring-方面:jar:5.1.3发行版:compile
+-org.mockito:mockito-core:jar:2.21.0:编译+-net.bytebuddy:byte-buddy:jar:1.8.15:编译
+-net.bytebuddy:byte-buddy-agent:jar:1.8.15:编译
-org.objenesis:objenesis:jar:2.6:编译
+-commons-io:commons-io:jar:2.6:编译
+-org.powermock:powermock-module-junit4:jar:2.0.0:test-org.powermock:powermock-module-junit4-common:jar:2.0.0:test
+-org.powermock:powermock-reflect:jar:2.0.0:test
-org.powermock:powermock-core:jar:2.0.0:test
+-org.powermock:powermock-api-mockito2:jar:2.0.0:test-org.powermock:powermock-api-support:jar:2.0.0:test
+-net.javacrumbs.shedlock:shedlock-:jar:2.5.0:compile+-net.javacrumbs.shedlock:shedlock-core:jar:2.5.0:compile
-org.SpringFramework:spring-context:jar:5.0.6.release:compile
+-net.javacrumbs.shedlock:shedlock-provider-jdbc-template:jar:2.5.0:compile-net.javacrumbs.shedlock:shedlock-provider-jdbc-internal:jar:2.5.0:compile-javax.mail:mail:jar:1.4:compile
-javax.activation:activation:jar:1.1:compile
而pom.xml
是:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>i.b.l</groupId>
<artifactId>oaa</artifactId>
<version>0.0.8-RELEASE</version>
<packaging>war</packaging>
<properties>
<domain.version>0.0.6-SNAPSHOT</domain.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<spring.boot.version>2.1.1.RELEASE</spring.boot.version>
<log4j.version>1.2.17</log4j.version>
<httpclient.version>4.5.6</httpclient.version>
<httpcore.version>4.4.10</httpcore.version>
<jackson-dataformat-yaml.version>2.9.7</jackson-dataformat-yaml.version>
<swagger.version>2.9.2</swagger.version>
<lombok.version>1.18.4</lombok.version>
<commons-lang3.version>3.8.1</commons-lang3.version>
<maven-checkstyle-version>3.0.0</maven-checkstyle-version>
<h2database.version>1.4.197</h2database.version>
<mockito.version>2.21.0</mockito.version>
<ojdbc.version>11.2.0</ojdbc.version>
<shedlock.version>2.5.0</shedlock.version>
<commons-io.version>2.6</commons-io.version>
<powermock.version>2.0.0</powermock.version>
<javax-mail.version>1.4</javax-mail.version>
</properties>
<dependencies>
<dependency>
<groupId>i.b.l</groupId>
<artifactId>domain</artifactId>
<version>${domain.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring.boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>${ojdbc.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>${httpcore.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson-dataformat-yaml.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2database.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-spring</artifactId>
<version>${shedlock.version}</version>
</dependency>
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-provider-jdbc-template</artifactId>
<version>${shedlock.version}</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>${javax-mail.version}</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.jks</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>src/main/resources/web.xml</webXml>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-version}</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<configLocation>java-checkstyle-rules.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<url>http://d1f2fwc2w7.boigroup.net:8081/nexus/repository/maven-releases</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://d1f2fwc2w7.boigroup.net:8081/nexus/repository/maven-snapshots</url>
</snapshotRepository>
</distributionManagement>
<profiles>
<profile>
<id>local</id>
<properties>
<activatedProfiles>local</activatedProfiles>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>prd</id>
<properties>
<activatedProfiles>prd</activatedProfiles>
</properties>
</profile>
<profile>
<id>war</id>
<properties>
<activatedProfiles>war</activatedProfiles>
</properties>
</profile>
</profiles>
</project>
我在ShedLock issues页面上发表了这篇文章,他们说这更有可能是一个相互冲突的依赖关系问题,而不是ShedLock的问题。
我怎样才能修好这个?
通过将shedlock的
更改为:
<dependency>
<groupId>net.javacrumbs.shedlock</groupId>
<artifactId>shedlock-spring</artifactId>
<version>${shedlock.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
</exclusions>
</dependency>
KnockoutJs会在值更新时自动跟踪依赖项。 它有一个称为dependency tracker (ko.dependencyDetection)的对象,它充当了双方之间用于订阅依赖关系的中间件。 以下是依赖性跟踪的算法。 Step 1 - 每当您声明一个计算的observable时,KO立即调用其求值函数来获取其初始值。 Step 2 - 订阅被设置为评估者读取的任何可观察对象。 在应用程序中
在我的Apache Camel/Spring Boot应用程序控制台中,我看到大量的骆驼追踪,从下面开始。根据这个camel.springboot.tracing=false应该禁用它,但它不起作用。寻找禁用跟踪的正确方法。
我认为这是spring boot Framework内部的依赖问题: 依附性层次制 所以我在pom.xml中添加了以下几行: 拉维。
我有以下代码: 这正常工作。但是,我还需要将Xalan作为依赖项添加到pom.xml中,当我这样做时,上面的代码会抛出一个错误:
我的项目是个springboot多模块项目,其中2个模块A,B, A的pom文件引用了B,B pom里也引用了A,现在启动报错。怎么能配置pom文件正常启动? 现在是把依赖的代码去掉了,在自己模块在写一遍,但是代码就重复了。希望通过配置文件消除这个问题。
我使用的是eclipse 2018、gradle 5.2.1、buildship 3.0.1。 我的配置看起来像: 我尝试根据building-spring-boot-2-projects-with-gradle创建spring boot 2 是: 但是,在我保存构建之后。gradle,项目和外部依赖关系消失,Spring Bootjar也没有下载。 我错了什么? 如果我使用gradle by s