小编Tud*_*riu的帖子

命令提示符中无法识别'wsimport'错误

我是网络服务的新手.我正在尝试使用此命令生成存根:

wsimport -d ./build -s ./src  -p com.ECS.client.jax http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl -b jaxws-custom.xml
Run Code Online (Sandbox Code Playgroud)

我在cmd中收到此错误:

wsimport无法识别

我的Java环境变量系统路径是C:\Program Files (x86)\Java\jdk1.7.0.我究竟做错了什么?


我使用netbeans中的wsimport而不是cmd来解决这个问题...但我仍然不知道为什么我不能从cmd中使用它.

java wsdl web-services wsimport web

7
推荐指数
2
解决办法
4万
查看次数

Mapstruct bidirectional mapping

I have the following example in which i have a separate domain layer and a separate persistence layer. I am using Mapstruct for mapping and I get StackOverflow when mapping from domain to entity or from entity to domain because of the bidirectional reference that always gets called on -> infinite loop scenario. How can I use Mapstruct for this scenario?

class User {
  private UserProfile userProfile;
}

class UserProfile {
 private User user;
}

@Entity
class UserEntity {
  @OneToOne …
Run Code Online (Sandbox Code Playgroud)

java mapstruct

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

Spring Boot 测试不启动上下文或加载依赖项

这是一个非常初学者的问题,但我无法解决。我有一个基本的 Spring Boot 应用程序,以及一个连接到云图集实例的 Spring Data MongoDB 存储库。问题是,在我的 Spring Boot 测试中,我的存储库未自动连接,并且未创建嵌入式 MongoDB 实例。如果我启动 Spring Boot 应用程序并在主类中自动装配存储库,那么就可以了。为什么它在我的测试中不起作用?

这是我的测试课:

@DataMongoTest
@ExtendWith(SpringExtension.class)
public class SampleServiceTest{


    @Autowired
    private SampleRepository sampleRepository;

    @Test
    public void shouldCreateSample(){
        sampleRepository.save(new Sample());
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的 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">
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.RELEASE</version>
        <relativePath></relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>



    <groupId>com.comand</groupId>
    <artifactId>business-owner-service</artifactId>
    <version>1.0-SNAPSHOT</version>
    <description>API Gateway</description>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId> …
Run Code Online (Sandbox Code Playgroud)

junit spring spring-data-mongodb spring-boot spring-boot-test

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

@SpringBootTest 不使用测试属性

我正在使用 jasypt 加密 Spring Boot 应用程序中的 application.properties。我的目标是更新我的集成测试,以便 jasypt 与测试加密器密码一起使用。我的问题是我的测试没有覆盖测试属性。

依赖项:

        <dependency>
            <groupId>com.github.ulisesbocchio</groupId>
            <artifactId>jasypt-spring-boot-starter</artifactId>
            <version>3.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.flapdoodle.embed</groupId>
            <artifactId>de.flapdoodle.embed.mongo</artifactId>
            <scope>test</scope>
        </dependency>
Run Code Online (Sandbox Code Playgroud)

我有两个 application.properties,一个在src/main/resources/application.properties 中,另一个在 src/test/application-test.properties 中。在测试属性中,我设置 jasypt.encryptor.password=test 并使用测试密码使用 jasypt ENC 值覆盖 spring.data.mongodb.uri。我的测试是这样的:

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;


@ExtendWith(SpringExtension.class)
@SpringBootTest
@ActiveProfiles("test")
@TestPropertySource("classpath:application-test.properties")
public class SpringBootAppTest{


    @Test
    public void shouldLoadContext(){
        //nothing to test
    }
}

Run Code Online (Sandbox Code Playgroud)

如您所见,我使用 JUnit5 …

java spring jasypt spring-boot junit-jupiter

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