小编Sur*_*tam的帖子

为什么BCryptPasswordEncoder的强度在4到31之间?

根据文件:

PasswordEncoder的实现,它使用BCrypt强哈希函数.客户端可以选择提供"强度"(也就是BCrypt中的日志轮次)和SecureRandom实例.强度参数越大,散列密码的工作量(指数式)就越多.默认值为10.

spring-security bcrypt

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

Websockets, SockJs, Stomp, Spring, RabbitMQ, 自动删除用户特定的队列

我希望有人能帮助我解决这个问题。我正在将 Spring 的 Websocket 支持与 SockJs 和 StompJs 一起使用。我订阅了这样的队列:

    var socket = new SockJS(localhost + 'websocket');
    stompClient = Stomp.over(socket);
    stompClient.connect('', '', function(frame) {
        stompClient.subscribe("/user/queue/gotMessage", function(message) {
            gotMessage((JSON.parse(message.body)));
        });
    }, function(error) {
    });
Run Code Online (Sandbox Code Playgroud)

这对于 Spring 的 SimpMessageSendingOperations 非常有效。但是有一个大问题。队列名称如下所示:gotMessage-user3w4tstcj并且它没有声明为自动删除队列,但这正是我想要的。否则,我有 10k 个未使用的队列。在队列没有消费者的那一刻,应该删除队列。我怎么能假设呢?

java spring rabbitmq sockjs spring-websocket

5
推荐指数
1
解决办法
1769
查看次数

如何在 Spring boot 中发送图像作为响应?

我是 Spring Boot (restController) 和 Angular 的初学者,我想用以下方法将图像发送到我的客户端(Angular):

@RestController public class ProductRestController { 
    @Autowired private ProductRepository pr;
    @GetMapping (path = "/ photoProduit / {id}", produces = org.springframework.http.MediaType.IMAGE_PNG_VALUE)
     public byte [] getPhoto (@PathVariable Long id) throws IOException { 
        Product p = pr.findById (id) .get (); return Files.readAllBytes (Paths.get (System.getProperty ("user.home") + "/ ecom / produits /" + p.getPhotoName ()));
        
    }
 }

Run Code Online (Sandbox Code Playgroud)

但 URL 返回代码500并出现此错误

There was an unexpected error 
(type = Internal Server Error, status = 500). C: \ Users …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot spring-restcontroller

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

Spring Boot H2 控制台返回 404

我有一个简单的 Springboot 应用程序并且它正在运行。我可以通过 Postman 调用 REST 端点。但是,当我尝试使用 http://localhost:8080/h2 访问控制台时,它一直返回 404。


2020-08-29 08:06:37.577  INFO 6507 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [

        name: default

        ...]

2020-08-29 08:06:37.644  INFO 6507 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.17.Final}

2020-08-29 08:06:37.645  INFO 6507 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found

2020-08-29 08:06:37.677  INFO 6507 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}

2020-08-29 08:06:37.787  INFO 6507 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

2020-08-29 …
Run Code Online (Sandbox Code Playgroud)

h2 spring-boot

0
推荐指数
1
解决办法
977
查看次数