小编abi*_*ter的帖子

在 gradle 中添加 apche cxf-bundle 作为依赖项时出现“不支持:http://javax.xml.XMLConstants/property/accessExternalDTD 异常”

尝试在我的应用程序中添加 apache-cxf 包。但是在运行应用程序时出现以下错误无法实例化 [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]:工厂方法“payloadRootAnnotationMethodEndpointMapping”抛出异常;嵌套异常是 java.lang.ExceptionInInitializerError

这是由引起的:java.lang.IllegalArgumentException:不支持:http://javax.xml.XMLConstants/property/accessExternalDTD

尝试在任务中添加以下属性

wsdl2java {
 System.setProperty('javax.xml.accessExternalSchema', 'all')
 System.setProperty('javax.xml.accessExternalDTD','all')
 generatedWsdlDir = file("src/main/generated-sources/")  // target directory for generated source code
 wsdlsToGenerate = [   //  2d-array of wsdls and cxf-parameters
                      ['src/main/resources/xsd/wsdl/***.wsdl'],
]
Run Code Online (Sandbox Code Playgroud)

}

added the dependency as 
compile group: 'org.apache.cxf', name: 'cxf-bundle', version: '2.4.2'
Run Code Online (Sandbox Code Playgroud)

出现以下错误

Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]: Factory method 'payloadRootAnnotationMethodEndpointMapping' threw exception; nested exception is java.lang.ExceptionInInitializerError

Caused by: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
    at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:576) ~[xalan-2.7.1.jar:?]
Run Code Online (Sandbox Code Playgroud)

java wsdl2java build.gradle

8
推荐指数
1
解决办法
1万
查看次数

无法在 junit 5 中使用 @ContextConfiguration 创建用于测试的 bean

我正在尝试为我的应用程序编写 junit 测试用例。使用 Junit 5 后,我无法使用 @ContextConfiguration 创建必要的 bean。

它没有抛出任何错误。但是在测试类中自动装配 bean 时,我得到了空值

我添加了以下依赖项

testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.0"
testCompile('org.junit.jupiter:junit-jupiter-params:5.3.0')
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.0"
Run Code Online (Sandbox Code Playgroud)

和我的代码

@ContextConfiguration(classes = ServiceTestContextConfiguration.class)
public class ApplicationConfigTest {

@Autowired
private ApplicationServiceConfiguration 
Run Code Online (Sandbox Code Playgroud)

应用服务配置;

@ContextConfiguration
public class ServiceTestContextConfiguration {
@Bean
public ApplicationServiceConfiguration applicationServiceConfiguration() {
    return new ApplicationServiceConfiguration();
}
Run Code Online (Sandbox Code Playgroud)

我正在使用 spring-boot 2。

java spring-boot junit5

5
推荐指数
1
解决办法
2927
查看次数

无法从 kotlin jacoco 测试覆盖率中排除生成的类

我试图从 jacoco 覆盖率报告中排除一些生成的类。使用 groovy 运行良好,但在转换为 Kotlin 后它不起作用

tasks.withType<JacocoCoverageVerification> {
afterEvaluate {
     files(classDirectories.files.forEach() {
        fileTree(it).apply {
            exclude("com/generate/**")
        }
    })
}
violationRules {
    rule {
        limit {
            minimum = BigDecimal(0.30)
        }

    }

}
Run Code Online (Sandbox Code Playgroud)

}

tasks.getByName("check")
.dependsOn(tasks.getByName("jacocoTestCoverageVerification"))
Run Code Online (Sandbox Code Playgroud)

但违规规则运作良好。

kotlin build.gradle

4
推荐指数
1
解决办法
2257
查看次数

标签 统计

build.gradle ×2

java ×2

junit5 ×1

kotlin ×1

spring-boot ×1

wsdl2java ×1