要在libxml_use_internal_errors(true);
$page_html = new DomDocument();
$ch = curl_init();
$timeout = 500;
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 3);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
if(!empty($data)){
$page_html->loadHTML($data);
}
中使用加密属性,我想使用Zalando的application.yml
项目。我按照https://github.com/zalando/spring-cloud-config-aws-kms中的说明操作,即我将其作为依赖项添加到config-aws-kms
但是后来我收到NoUniqueBeanDefinitionException错误。
pom.xml
的pom.xml:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field encryptor in org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration required a single bean, but 2 were found:
- defaultTextEncryptor: defined by method 'defaultTextEncryptor' in org.springframework.cloud.config.server.config.EncryptionAutoConfiguration$DefaultTextEncryptorConfiguration
- kmsTextEncryptor: defined by method 'kmsTextEncryptor' in de.zalando.spring.cloud.config.aws.kms.KmsEncryptionConfiguration$KmsTextEncryptorConfiguration
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.security.crypto.encrypt.TextEncryptor' available: expected single matching bean but found 2: defaultTextEncryptor,kmsTextEncryptor
答案 0 :(得分:1)
Try to swap the spring-cloud-config-starter
with the spring-cloud-config-aws-kms
order, because Spring's DefaultTextEncryptorConfiguration
has a @ConditionalOnMissingBean
annotation, but the other one haven't got a ConditionalOnMissingBean annotation and that's why you get an Exception.