小编Tej*_*jal的帖子

如何检查HikariCP连接池在Java中是否有效?

Log4j 在我的应用程序中使用的配置文件中编写了以下属性当我运行项目时.

我正在关注message.does意味着在我的项目中配置连接池?如果不是那么它将如何?

INFO:internal.ConnectionProviderInitiator - HHH000130:实例化显式连接提供程序:com.zaxxer.hikari.hibernate.HikariConnectionProvider

我也提到了以下链接

链接在这里

数据源设置

hibernate.datasource.driver-class-name=com.mysql.jdbc.Driver
hibernate.datasource.url=jdbc:mysql://localhost:3306/mydb
hibernate.datasource.username=root
hibernate.datasource.password=root
Run Code Online (Sandbox Code Playgroud)

HikariCP设置

hibernate.hikari.dataSource.url=jdbc:mysql://localhost:3306/mydb
hibernate.hikari.idleTimeout=10
hibernate.hikari.maximumPoolSize=30
hibernate.hikari.minimumIdle=15
hibernate.connection.provider_class=com.zaxxer.hikari.hibernate.HikariConnectionProvider
hibernate.hikari.dataSourceClassName=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
Run Code Online (Sandbox Code Playgroud)

java mysql hibernate connection-pooling hikaricp

12
推荐指数
3
解决办法
5239
查看次数

用Redis来休眠二级缓存 - 它会提高性能吗?

我目前正在使用Spring MVC4hibernate 4开发一个应用程序.我已经实现了hibernate二级缓存以提高性能.如果我使用 Redis这是一个内存数据结构存储,用作数据库,缓存等,性能会提高,但会是一个剧烈的变化吗?

java spring caching hibernate redis

10
推荐指数
1
解决办法
1388
查看次数

如何在不重启tomcat服务器的情况下从属性文件中更改spring scheduler的cron表达式?

我正在使用spring scheduler.这个工作正常,但是每当我需要重新启动tomcat server时,我在application.properties中更改了cron.expression值.有什么方法可以让它像动态一样自动更改会反映出来吗?我也谷歌也没有得到我的应用程序的任何解决方案.我已经给出了如下代码片段:

application.properties

cron.expression=0 58 23 * * ?
Run Code Online (Sandbox Code Playgroud)
@Scheduled(cron = "${cron.expression}", zone = "IST")
public void sendEmail() throws Exception {



}
Run Code Online (Sandbox Code Playgroud)

java spring-mvc spring-scheduled tomcat8

9
推荐指数
1
解决办法
940
查看次数

使用Java nio文件walk()读取文件

我正在使用流API读取文件,readFile()同时在第一个循环中循环访问时正在调用方法。我正在获取路径值,如何删除该路径值,因为我正面临数组索引超出范围的异常。文件命名会话为“ FileName_17072018”。

public class RemoveCVVFilesjob {

    public static void main(String[] args) throws IOException {
        List<String> fileList;
        fileList = readFile();

        for (String str : fileList) {
            String[] strArr = str.split("_");
            System.out.println(strArr[1]);
        }
    }

    private static List<String> readFile() throws IOException {

        try (Stream<Path> paths = Files.walk(Paths.get("D:\\Projects\\Wallet\\CVVFiles"))) {

            List<String> list = paths.map(path -> Files.isDirectory(path) ? 
                path.getFileName().toString() + '/' : 
                path.getFileName().toString()).collect(Collectors.toList()
            );
            return list;
        }
    }
Run Code Online (Sandbox Code Playgroud)

java file list java-8 java-stream

6
推荐指数
1
解决办法
1665
查看次数

Pdf下载使用java jersey和spring security在给出邮递员的请求时给出错误

我正在使用以下邮递员"发送和下载按钮"来点击jersy API,但我无法下载pdf而不是只有正常文件被下载.如果我评论 @RolesAllowed("ROLE_USER")和dircetly从浏览器点击API然后它似乎工作正常,但我想要spring security.please建议解决这个问题

在此输入图像描述

JAVA CODE

  @GET
    @Path("/{userId}/resume/downloadpdf")
    @Produces("application/pdf")
    @ApiOperation(value = "Gets user resume pdf",
            response = Response.class)
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "UserResume information found"),
            @ApiResponse(code = 401, message = "Unauthorized request"),
            @ApiResponse(code = 404, message = "UserResume information not found"),
            @ApiResponse(code = 400, message = "Bad request"),
            @ApiResponse(code = 500, message = "Unknown internal server error")
    })
   @RolesAllowed("ROLE_USER")
    @Override
    public Response downloadResumePdf(@PathParam("userId") String userId) throws IOException, DocumentException {


        String resumeHTMLData ="<h1> hi </h1>";

        StreamingOutput …
Run Code Online (Sandbox Code Playgroud)

java pdf spring jersey spring-security

5
推荐指数
0
解决办法
219
查看次数