下午好社区,我有一个关于 django rest 框架页面的问题,在这种情况下,我设法在视图集中做到了,但在集体行动中我未能实现。
附上 django rest 框架中答案的图片
行动
class PostPageNumberPagination(PageNumberPagination):
page_size=10
class InterfacesViewSet(viewsets.ModelViewSet):
queryset=Interfaces.objects.all()
serializer_class=InterfaceSerializer
pagination_class=PostPageNumberPagination
# La siguiente funcion es un decorador(funciones extra) de la clase RegistrosViewSet para poder manipular los datos que voy a presentar de acuerdo a la URL que se le asigne con el url_path
# El siguiente action actua para poder presentar todos los datos de todos los objetos
@action(methods=['get'],detail=False,url_path='registros-data-table',url_name='registros_data_table')
def registros_data_table(self, request):
paginator=PostPageNumberPagination
return Response(
{
'id_interface':interface.id_interface,
'id_EquipoOrigen':interface.id_EquipoOrigen_id,
'EquipoOrigen':interface.id_EquipoOrigen.nombre,
'LocalidadOrigen':interface.id_EquipoOrigen.localidad,
'CategoriaOrigen':interface.id_EquipoOrigen.categoria, …
Run Code Online (Sandbox Code Playgroud) 下午好
我刚刚开始使用 Kubernetes,正在使用 HPA (HorizontalPodAutoscaler):
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: find-complementary-account-info-1
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: find-complementary-account-info-1
minReplicas: 2
maxReplicas: 5
metrics:
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageUtilization: 50
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在控制台上查看指标时,它没有显示:
[dockermd@tmp108 APP-MM-ConsultaCuentaPagadoraPospago]$ kubectl get hpa
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
find-complementary-account-info-1 Deployment/find-complementary-account-info-1 <unknown>/50% 2 5 2 143m
Run Code Online (Sandbox Code Playgroud)
我的清单是:
apiVersion: apps/v1
kind: Deployment
metadata:
name: find-complementary-account-info-1
labels:
app: find-complementary-account-info-1
spec:
replicas: 2
selector:
matchLabels:
app: find-complementary-account-info-1
template:
metadata:
labels:
app: find-complementary-account-info-1
spec: …
Run Code Online (Sandbox Code Playgroud) 我在尝试使用 maven 构建我的项目时遇到问题,更具体地说,当需要依赖项时,即 Oracle JDBC 7 的依赖项,我一直在寻找解决方案几个小时却一无所获,甚至在此处咨询了一些与此相关的问题,但一无所获
C:\Users\E10697\Desktop\Contenedores\oracle_contenedores\Entorno-Oracle-sobre-Docker-master\4. Consumo de la Oracle DB a traves de un API Rest\4.1。Elaboración del API Rest\4.1.2。实现 API Rest\OpenwebinarDockerAPI - RESUELTO\OPENWE~1>mvn clean install
错误:[错误] 无法在项目 app-rest-api 上执行目标:无法解析项目 openwebinar.marvel.app:app-rest-api:war:0.1.0-SNAPSHOT:找不到工件 com.oracle 的依赖项:ojdbc7:jar:12.1.0 在 spring-milestones ( https://repo.spring.io/milestone )
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] rest-api [pom]
[INFO] app-rest-api [war]
[INFO] app-web [war]
[INFO]
[INFO] ---------------------< openwebinar.marvel.app:app >---------------------
[INFO] Building rest-api 0.1.0-SNAPSHOT [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ …
Run Code Online (Sandbox Code Playgroud) 下午好,我有一个查询,我从 Quarkus 开始,在使用其中的日志时遇到问题,我正在使用一个使用 GET 动词的简单服务,在放置日志行时它会抛出一个错误java.lang.NullPointerException。这是我的主要代码:
package com.tmve.subscriber;
import com.tmve.subscriber.repository.FindPrepaidSubscriberICCIDRepository;
import io.agroal.api.AgroalDataSource;
import org.jboss.logging.Logger;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
@Path("/api")
public class FindPrepaidSubscriberICCID {
@Inject
AgroalDataSource defaultDataSource;
Logger log;
FindPrepaidSubscriberICCIDRepository repository= new FindPrepaidSubscriberICCIDRepository();
private final String movil="142910399";
@GET
@Produces(MediaType.TEXT_PLAIN)
public HashMap<String,String> hello() {
HashMap<String,String> map=new HashMap<>();
map=repository.getResources(defaultDataSource,movil);
log.info("movil: "+movil);
return map;
}
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序属性
quarkus.datasource.db-kind=oracle
#quarkus.datasource.jdbc.driver=oracle.jdbc.driver.OracleDriver
#quarkus.datasource.jdbc.driver=io.opentracing.contrib.jdbc.TracingDriver
quarkus.datasource.jdbc.url=jdbc:oracle:thin:@172.xx.2.xxx:1522/IVR
quarkus.datasource.username=${USERNAME_CONNECTION_BD:psp}
quarkus.datasource.password=${PASSWORD_CONNECTION_BD:xxxxxxxxx}
quarkus.http.port=${PORT:8080}
quarkus.log.level=INFO
quarkus.log.category."org.hibernate".level=DEBUG
# Send output to a trace.log file under the /tmp directory …
Run Code Online (Sandbox Code Playgroud) 下午好,我目前正在使用 JAVA 和 Quarkus 中的 api,在其中我通过 GET 方法接收 url 中使用 AES 加密的参数,问题是加密带有特殊字符,例如 +/ 现在读取服务将其作为路径的 url
这是我的 AES 加密代码、加密和解密方法,我将其用于加密:
package com.tmve.util;
import lombok.NoArgsConstructor;
import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.*;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.util.Arrays;
import java.util.Base64;
@NoArgsConstructor
public class EncryptUtil {
private static byte[] initializationVector = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
private static byte[] key;
private static SecretKeySpec secretKey;
public String encrypt(String input, String key)
throws NoSuchPaddingException, NoSuchAlgorithmException,
InvalidAlgorithmParameterException, InvalidKeyException,
BadPaddingException, IllegalBlockSizeException {
byte[] desKeyData = key.getBytes();
Cipher …
Run Code Online (Sandbox Code Playgroud)