spring-boot

Axon - Cannot emit query update in different microservice

我只是一个虾纸丫 提交于 2021-02-11 07:14:07
问题 I'm bothering with situation when I want to emit query update via queryUpdateEmitter but in different module (microservice). I have application built upon microservices and both are connected to the same Axon Server. First service creates subscriptionQuery, and sends some commands. After a while (through few commands and events) second service handles some event, and emits update for firstly subscribed query. Unfortunately it seems like this emit doesn't get to subscriber. Queries are exactly

Axon - Cannot emit query update in different microservice

不羁的心 提交于 2021-02-11 07:13:24
问题 I'm bothering with situation when I want to emit query update via queryUpdateEmitter but in different module (microservice). I have application built upon microservices and both are connected to the same Axon Server. First service creates subscriptionQuery, and sends some commands. After a while (through few commands and events) second service handles some event, and emits update for firstly subscribed query. Unfortunately it seems like this emit doesn't get to subscriber. Queries are exactly

Cannot catch DataIntegrityViolationException

青春壹個敷衍的年華 提交于 2021-02-11 06:49:28
问题 I am using Spring Boot 2 with spring-boot-starter-data-jpa with an underlying MariaDB. I have table with a unique key "username". I want to catch DataIntegrityViolationException if this constraint is violated, but it seems like Spring is logging DataIntegrityViolationException and does not rethrow the after logging(my best guess). MySQLIntegrityConstraintViolationException is thrown instead. I would like to catch DataIntegrityViolationException in UserService.createUser(..) . Here are a

Cannot catch DataIntegrityViolationException

邮差的信 提交于 2021-02-11 06:48:12
问题 I am using Spring Boot 2 with spring-boot-starter-data-jpa with an underlying MariaDB. I have table with a unique key "username". I want to catch DataIntegrityViolationException if this constraint is violated, but it seems like Spring is logging DataIntegrityViolationException and does not rethrow the after logging(my best guess). MySQLIntegrityConstraintViolationException is thrown instead. I would like to catch DataIntegrityViolationException in UserService.createUser(..) . Here are a

Spring Boot Health Check - SQS Consumer

旧街凉风 提交于 2021-02-11 06:36:25
问题 Is there a Spring Boot Actuator Health Check endpoint for SQS? I have built a SQS consumer and I want to check if SQS is up and running. I am not using JMSlistener for connecting to SQS but rather using Spring Cloud Libraries. I implemented the below health check endpoint. This returns the below error when I delete the queue and try to hit the health check endpoint. If there is a connectivity issue or if the SQS service goes down , will I be getting a similar error which will eventually cause

How config gson in Spring boot?

强颜欢笑 提交于 2021-02-11 05:59:03
问题 Spring Boot 2 In application.yml http: converters: preferred-json-mapper: gson Now I write class with custom settings for Gson : public class GsonUtil { public static GsonBuilder gsonbuilder = new GsonBuilder(); public static Gson gson; public static JsonParser parser = new JsonParser(); static { // @Exclude -> to exclude specific field when serialize/deserilaize gsonbuilder.addSerializationExclusionStrategy(new ExclusionStrategy() { @Override public boolean shouldSkipField(FieldAttributes

Kotlin + SpringBootTest + Junit 5 + AutoConfigureMockMvc: test passing when it was supposed to fail (seems @BeforeEach not taking effect)

大城市里の小女人 提交于 2021-02-11 04:52:41
问题 I coded a very simple and common CRUD in Kotlin. I want to do basic tests as testing post, delete, get and put. Probably I understood something wrong: I used Beforeeach aimed to insert a register so I could check during get test. I don't get exception but it seems during get test it always returning ok when it should be NOT_FOUND for any other id different than 1 in bellow test. Any clue or guidance in right direction will be wellcome even if see other bad practice bellow based on my purpose

Kotlin + SpringBootTest + Junit 5 + AutoConfigureMockMvc: test passing when it was supposed to fail (seems @BeforeEach not taking effect)

[亡魂溺海] 提交于 2021-02-11 04:51:13
问题 I coded a very simple and common CRUD in Kotlin. I want to do basic tests as testing post, delete, get and put. Probably I understood something wrong: I used Beforeeach aimed to insert a register so I could check during get test. I don't get exception but it seems during get test it always returning ok when it should be NOT_FOUND for any other id different than 1 in bellow test. Any clue or guidance in right direction will be wellcome even if see other bad practice bellow based on my purpose

Should you expose a primary key in REST API URLs?

元气小坏坏 提交于 2021-02-11 03:09:17
问题 I'm very new to Spring. I'm trying to create a REST API using Spring Boot and I'm stuck whether to expose my user's primary key or not which also happens to be their email. Something like api/user/example@gmail.com . A big part of me says it's okay since it would sensible to expose it as it is the identifier for that specific record when viewing, deleting, and updating. Is there a security risk for this? What is the best practice for such implementation? Right now I'm combining the

Should you expose a primary key in REST API URLs?

久未见 提交于 2021-02-11 03:00:00
问题 I'm very new to Spring. I'm trying to create a REST API using Spring Boot and I'm stuck whether to expose my user's primary key or not which also happens to be their email. Something like api/user/example@gmail.com . A big part of me says it's okay since it would sensible to expose it as it is the identifier for that specific record when viewing, deleting, and updating. Is there a security risk for this? What is the best practice for such implementation? Right now I'm combining the