我是Java EE的新手,并尝试使用ServletContextListener,并且侦听器作业是连接到数据库bla bla.当我尝试启动服务器(Tomcat 9)时,它仍然停留在:
"信息:至少有一个JAR被扫描用于尚未包含TLD的TLD.启用此记录器的调试日志记录,以获取已扫描但未找到TLD的完整JAR列表.在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间."
所以我改变了"Logging properties file"中的一些属性,如下所示:
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# …
Run Code Online (Sandbox Code Playgroud) 我正在尝试加密和解密密码,并且这些生成密钥到目前为止都很好.现在我需要将此密钥存储在属性文件中,但是当我添加密钥时,它看起来像这样:
#Tue Nov 01 08:22:52 EET 2016
KEY=\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000
Run Code Online (Sandbox Code Playgroud)
所以我怀疑我的代码可能有问题?!?!
并且我的代码中有一部分=
private byte[] key = new byte[16];
public void addProperties(String x, String z) {
Properties properties = new Properties();
String propertiesFileName = "config.properties";
try {
OutputStream out = new FileOutputStream(propertiesFileName);
properties.setProperty(x, z);
properties.store(out, null);
} catch (IOException e) {
e.printStackTrace();
}
}
public void generateKey() {
KeyGenerator keygen;
SecretKey secretKey;
byte[] keybyte = new byte[64];
try {
keygen = KeyGenerator.getInstance("AES");
keygen.init(128);
secretKey = keygen.generateKey();
keybyte = secretKey.getEncoded();
key = keybyte;
//THIS …
Run Code Online (Sandbox Code Playgroud) 我正在研究酒店管理应用程序[桌面],我注意到,酒店系统的日期更改时间不是00:00 am,在凌晨1点到6点之间 , 因此预订和房间状态等应该保持到审核时间.当用户审核新的一天将开始.
这就是为什么我需要创建一个方法,在午夜停止日期更改并在单击审核按钮时返回新日期.简而言之,我必须创建日期的中央系统.
结果是; 当我在所有课程中使用这个日期时,每个方法都会同步工作[封锁,预订,登记,结账等],但我找不到好办法.
我正在考虑一些像这样的代码:
package com.coder.hms.utils;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
public class CustomDateFactory {
private Date date;
private Calendar calendar;
private SimpleDateFormat sdf;
public CustomDateFactory() {
//for formatting date as desired
sdf = new SimpleDateFormat("yyyy-MM-dd");
}
public void setValidDateUntilAudit(int counter) {
final Timer timer = new Timer();
final TimerTask task = new TimerTask() {
@Override
public void run() {
//get hour and …
Run Code Online (Sandbox Code Playgroud)