我正在使用spring 4.0.5和hibernate 4.3.5; 我正面临一个hibernate的错误,我无法弄清楚我错在哪里(因为我确定我错了).我有一个与自身相关的表,它代表一个Web树,每个根节点可以有几个子节点,所以我创建了这个类:
@DynamicUpdate
@Cache(region = "it.eng.angelo.spring.dao.hibernate.models.WebTree", usage = CacheConcurrencyStrategy.READ_WRITE)
@Entity
@Table(name = "MEDIA_GALL_TREE", indexes = {@Index(name = "NOME_FOLDER_IDX", columnList = "NOME_FOLDER")})
public class WebTree extends AbstractModel
{
private static final long serialVersionUID = -4572195412018767502L;
private long id;
private String text;
private boolean opened;
private boolean disabled;
private boolean selected;
private Set<WebTree> children = new HashSet<WebTree>(0);
private Set<Media> media = new HashSet<Media>(0);
private WebTree father;
private WcmDomain dominio;
public WebTree()
{
super();
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = …Run Code Online (Sandbox Code Playgroud) 我正在使用spring集成及其对MQTT的支持; 我看到了spring集成文档,我的简单测试用例是在MQTT主题上发布消息.Spring文档位于:http://docs.spring.io/spring-integration/reference/html/mqtt.html#_configuring_with_java_configuration_15
我正在使用这些版本:
我构建了这个简单的配置类:
@Configuration
@IntegrationComponentScan
public class CommunicationServerApplication
{
@Bean
public MqttPahoClientFactory mqttClientFactory()
{
DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
factory.setServerURIs(mqttServerUris);
if (StringUtils.hasText(mqttUsername) && StringUtils.hasText(mqttPassword))
{
factory.setUserName(mqttUsername);
factory.setPassword(mqttPassword);
}
factory.setConnectionTimeout(mqttConnectionTimeout);
factory.setKeepAliveInterval(mqttKeepAliveInterval);
factory.setPersistence(new MqttDefaultFilePersistence(mqttPersistenceFileDirectory));
return factory;
}
@Bean
@ServiceActivator(inputChannel = "mqttOutboundChannel", autoStartup="true")
public MessageHandler mqttOutbound()
{
String clientId = mqttClientId;
if( !StringUtils.hasText(clientId) )
{
clientId = UUID.randomUUID().toString();
}
MqttPahoMessageHandler messageHandler = new MqttPahoMessageHandler(clientId, mqttClientFactory());
messageHandler.setAsync(true);
messageHandler.setDefaultTopic(mqttTopic);
if( mqttQos >= 0 && mqttQos <=2 )
{
messageHandler.setDefaultQos(mqttQos); …Run Code Online (Sandbox Code Playgroud) 春季休息模板引发了以下异常
org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class [Lcom.flightsms.core.dto.AirlineResponseDTO;] and content type [text/html;charset=UTF-8]
Run Code Online (Sandbox Code Playgroud)
这是我的 json 响应
[
{
"airlineId": "1",
"nameAirline": "American Airlines",
"codeIataAirline": "AA",
"iataPrefixAccounting": "1",
"codeIcaoAirline": "AAL",
"callsign": "AMERICAN",
"type": "scheduled",
"statusAirline": "active",
"sizeAirline": "963",
"ageFleet": "10.9",
"founding": "1934",
"codeHub": "DFW",
"nameCountry": "United States",
"codeIso2Country": "US"
}
]
Run Code Online (Sandbox Code Playgroud)
dto类
@Data
public class AirlineResponseDTO {
private String airlineId;
private String nameAirline;
private String codeIataAirline;
private String iataPrefixAccounting;
private String codeIcaoAirline;
private String callsign; …Run Code Online (Sandbox Code Playgroud) 我正在使用commons-math 3.6.1.
我需要将double值舍入为2进制
我们假设这是我的双重值:
double d = 400.54540997260267;
Run Code Online (Sandbox Code Playgroud)
现在通过舍入这个数字,我期待结果 400.54
相反,如果我的数字是双倍的,d1 = 400.54640997260267;我期待结果400.55
现在我正在使用此代码:
Precision.round(d, 2, BigDecimal.ROUND_DOWN);
Run Code Online (Sandbox Code Playgroud)
如果我使用舍入方法,BigDecimal.ROUND_DOWN我总是得到最低的舍入.我应该使用哪种舍入方法才能得到我所掌握的内容?
谢谢Angelo
UPDATE
我没有理解downvoting的原因我尝试了以下代码:
public class TestCalcoli
{
private static final Logger logger = LoggerFactory.getLogger(TestCalcoli.class.getName());
private void calc(double d)
{
double result = Precision.round(d, 2, BigDecimal.ROUND_HALF_DOWN);
double result2 = Precision.round(d, 2, BigDecimal.ROUND_HALF_UP);
logger.info("d--> "+d+" result --> "+result+" result2 --> "+result2);
}
@Test
public void calcola()
{
try
{
double d = 400.54540997260267;
double d1 = 400.54640997260267;
calc(d1);
calc(d); …Run Code Online (Sandbox Code Playgroud) 我的 K8S 集群遇到一个奇怪的问题
基本上我有2个应用程序:
我配置了 WSO2 以便使用这个外部 SAML2 IDP
当我尝试通过 X509 登录时,WSO2 向我显示登录页面,我单击智能卡并重定向到外部 SAML IDP。
在这种情况下,nginx 入口给我 502 错误网关。如果我复制 URL,关闭浏览器并再次尝试直接访问 X509 IDP,一切都很好。
请注意,我使用的是另一个外部 SAML IDP,在这种情况下,重定向工作得很好
2个外部IDP的区别在于我在pass-through中配置了X509 SAML IDP的入口控制器,因为我需要X509证书被我的Java应用程序使用
谁能告诉我为什么我会有这种奇怪的行为?
谢谢
安杰洛
更新
在这里你可以找到我的https://raw.githubusercontent.com/angeloimm/nginx_configuration/main/nginx.confnginx.conf
这是我的 ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: eid-tls-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/rewrite-target: /eid-tsl/
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
tls:
- hosts:
- login-cns-test.it
rules:
- host: login-cns-test.it
http:
paths:
- path: / …Run Code Online (Sandbox Code Playgroud) 我们正在使用 Kubernetes,我们需要检查客户端证书。我们需要的是配置 Nginx 入口控制器,以便将客户端证书(如果存在)传递给后端服务。我们在我们的测试环境中成功配置了它。这里我们有以下版本:
我们使用了这个入口配置:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: login-cns-produzione-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/configuration-snippet: "proxy_set_header X-SSL-CERT $ssl_client_escaped_cert;"
nginx.ingress.kubernetes.io/server-snippet: "ssl_verify_client optional_no_ca ;"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
tls:
- hosts:
- login-cns.it
rules:
- host: login-cns.it
http:
paths:
- path: /
backend:
serviceName: login-cns-produzione-service
servicePort: 443
Run Code Online (Sandbox Code Playgroud)
在我们的生产环境中,有些东西比测试要新。这些是生产中的版本:
生产中的问题是,虽然我们指定了指令,optional_no_ca但入口控制器要求客户端证书并尝试验证它,但它失败了你知道为什么会发生这种情况吗?
谢谢
安杰洛
编辑
通过阅读这里,我似乎应该使用这些注释。但是通过添加它们,Nginx 不会询问客户端证书
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: login-cns-test-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/backend-protocol: …Run Code Online (Sandbox Code Playgroud) 我有一个 Maven 多模块项目,在 saml2 场景中使用 spring boot 2.6.4 和 spring security。
据我所知,spring 使用 opensaml,更准确地说是 opensaml 4.1.1
我将此依赖项添加到我的 saml maven 模块的 pom 中:
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-core</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-saml-api</artifactId>
<version>4.1.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-saml-impl</artifactId>
<version>4.1.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-security-api</artifactId>
<version>4.1.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-security-impl</artifactId>
<version>4.1.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml-profile-api</artifactId>
<version>4.1.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion> …Run Code Online (Sandbox Code Playgroud) 我们正在考虑在我们需要做路线规划的项目中使用它.我们遇到的第一个问题是我们有非常dyanimc变量代表我们的重量值; 这意味着我们不能使用收缩层次算法因为每当这些变量中的一个发生变化时我们应该重新创建"收缩"图,所以我们考虑配置graphhopper以便不使用CH算法
在这种情况下,是否可以修改graphhopper代码以支持此动态边缘权重值?例如,假设我们有节点A和节点B以及边缘A-B; 让我们假设这个边有一个值3在我们的场景中,可以有一个事件可以将边A-B的值从3修改为6或从3修改为2我们可以修改代码以支持此功能吗?这是否依赖于DataAccess实现?
谢谢Angelo
spring ×2
configmap ×1
github ×1
graphhopper ×1
hibernate ×1
java ×1
json ×1
kubernetes ×1
maven ×1
nginx ×1
opensaml ×1
rest ×1
resttemplate ×1
spring-boot ×1