小编Roc*_*ver的帖子

javax.net.ssl.SSLException:<>的证书与任何主题备用名称都不匹配:[]

当我尝试使用Postman命中URL时,通过使用我的个人证书可以正常工作。但是当我使用Rest Assured测试用例尝试访问URL时,将抛出上述异常。

配置类别

public class Configuration {

    protected SSLConfig config = null;
    private static final Logger LOG = LoggerFactory.getLogger(Configuration.class);

    @SuppressWarnings("deprecation")
    @BeforeClass
    public void setKeystore()

    {
        KeyStore keyStore = null;

        KeyStore trustStore = null;
        try {
            String certPassword = System.getProperty("certPassword");
            String certPath = System.getProperty("certPath");

            String trustStorePassword = System.getProperty("trustStorePassword");
            String trustStorePath = System.getProperty("trustStorePath");
            Validate.notNull(certPath, "Path to Certificate on the file system cannot be null");
            Validate.notEmpty(certPassword, "Password cannot be empty");
            Validate.notNull(trustStorePath, "Path to trustStore on the file system cannot be null");
            Validate.notEmpty(trustStorePassword, "TrustStore …
Run Code Online (Sandbox Code Playgroud)

java ssl https rest-assured

6
推荐指数
1
解决办法
7143
查看次数

从 Mono 返回 Java 对象

我正在尝试从 Mono 获取 Json 字符串。我尝试使用 block() 方法来获取对象,它工作正常,但是当我使用 map/flatmap 时,我没有看到以下代码行被执行。而且我看到帐户 Mono 不为空。

private String getJsonString( Mono<Account> account) {
        response.map(it->{
           **// call is not coming here** 
            val json = mapper.writeValueAsString(it)
            System.out.println(son)
        });
    }
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么吗?

java spring reactor java-stream spring-webflux

6
推荐指数
1
解决办法
9866
查看次数

更新实体(如果已存在)或使用 spring jpa 创建

我是 spring data jpa 的新手。我有一个场景,如果不存在,我必须创建一个实体,或者根据非主键名称进行更新。下面是我编写的用于创建新实体的代码,它工作正常,但如果已经存在记录,它会创建重复项。如何编写一个方法来更新是否存在,我通常从客户端获取记录列表。

@Override
@Transactional
public String createNewEntity(List<Transaction> transaction) {

   List<Transaction> transaction= transactionRespository.saveAll(transaction);
}
Run Code Online (Sandbox Code Playgroud)

java spring spring-data spring-data-jpa

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

我们可以在 Spring 的实体对象上使用 @autowired 吗?

我有一个名为 的实体类Customer,我在另一个类中使用此实体对象来设置数据。当我像下面一样使用这个对象时

@Autowired
Customer customer
Run Code Online (Sandbox Code Playgroud)

Spring 抱怨请在您的类中配置 bean。

我们可以对实体对象使用自动装配吗?

java spring spring-boot

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

IBMMQ:消息以二进制形式发布但以字符串形式发送

我正在尝试使用 java 向 ibmmq 发布一条简单的消息。消息发送成功。但是当我在 ibm 控制台上检查队列时。消息显示为 在此处输入图片说明

但我期待作为简单的字符串。

在此处输入图片说明

这是我的代码。当我尝试转换时,我收到以下消息 jms_bytes 类型的消息无法将其正文分配给 java.lang.String

import com.ibm.mq.*;
import com.ibm.mq.constants.MQConstants;
import com.ibm.mq.jms.MQQueueConnectionFactory;
import com.ibm.msg.client.jms.JmsFactoryFactory;
import com.ibm.msg.client.wmq.WMQConstants;

import javax.jms.*;
import java.io.IOException;
import java.util.Hashtable;

public class PublisherTest
{
    static private String CHANNEL = "anychannel";
    static private int    PORT = 1414;
    static private String HOST = localhost;
    static private String QMANAGER = "QM1";
    static private String QUEUE = "queue.test";
    static private String USER = USER;
    static private Hashtable<String, Object> props =
            new Hashtable<String, Object>();
    static MQQueueManager qMgr …
Run Code Online (Sandbox Code Playgroud)

java jms mq spring-jms ibm-mq

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