我的POJO:
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import lombok.Data;
@Entity
@Table(name="user_linked_email")
@IdClass(UserLinkedEmailKey.class)
@Data
public class UserLinkedEmail implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
@Id
private Integer userId;
@Id
private String linkedEmail;
/**
* The Following are appearing in JSON response
*/
private boolean status;
private boolean preferredFlag;
}
Run Code Online (Sandbox Code Playgroud)
UserLinkedEmailKey类:
public class UserLinkedEmailKey implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
private Integer userId; …Run Code Online (Sandbox Code Playgroud) 我有一个springboot应用程序,当尝试使用groovy配置使用logback进行日志记录时,我收到以下错误:
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '3 gb' with class 'java.lang.String' to class 'ch.qos.logback.core.util.FileSize'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319)
Run Code Online (Sandbox Code Playgroud)
我的groovy配置文件:
import ch.qos.logback.classic.PatternLayout
import static ch.qos.logback.classic.Level.INFO
scan("60 seconds")
def LOG_PATH = "logs"
def LOG_ARCHIVE = "${LOG_PATH}/archive"
appender("RollingFile-Appender", RollingFileAppender) {
file = "${LOG_PATH}/rollingfile.log"
rollingPolicy(TimeBasedRollingPolicy) {
fileNamePattern = "${LOG_ARCHIVE}/Rainbow_Notifications.log%d{yyyy-MM-dd}.log"
maxHistory = 30
totalSizeCap = "3 gb"
}
encoder(PatternLayoutEncoder) {
pattern = "%msg%n"
}
}
logger("com.something", INFO, ["RollingFile-Appender"])
Run Code Online (Sandbox Code Playgroud)
注:我已尽力,甚至这些字符串:文件大小:3gb,3 gb,3GB,3096mb,3096 …
CloseableHttpClient client = HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();
Run Code Online (Sandbox Code Playgroud)
给我一个错误:
[sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
Run Code Online (Sandbox Code Playgroud)
javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效认证路径
即它没有按预期添加所有自签名证书..
我的 HTTPClient 版本是 4.5.1,HTTPCore 是版本 4.4.4
请给我一个不使用 SSLContextBuilder 等不推荐使用的方法的解决方案
我的常量文件:
@Component
public class Constants {
public static String ROOT_DOMAIN;
@Value("${setting.rootDomain}")
private void setRootDomain(String rootDomain) {
ROOT_DOMAIN = rootDomain;
}
...
}
Run Code Online (Sandbox Code Playgroud)
我的settings.properties:
setting.rootDomain=example.com
Run Code Online (Sandbox Code Playgroud)
我的推荐课程和方法:
@Component
public class MyServiceClass
{
public void doSomething()
{
System.out.println("Root is:" + Constants.ROOT_DOMAIN);
}
}
Run Code Online (Sandbox Code Playgroud)
但根域即将为空
[更新] 我的 spring-master.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:/META-INF/spring/local/settings.properties</value>
<value>classpath*:/META-INF/spring/${DEPLOY_ENVIRONMENT}/settings.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true"/>
<property name="ignoreResourceNotFound" value="true" />
<property name="searchSystemEnvironment" value="true" /> …Run Code Online (Sandbox Code Playgroud) java ×4
spring ×2
json ×1
logback ×1
logging ×1
lombok ×1
spring-boot ×1
spring-data ×1
ssl ×1