spring-boot

Dockerized Spring boot app connect to database docker image

人盡茶涼 提交于 2021-02-08 08:48:35
问题 I have a basic spring boot application with gradle which makes calls to an Oracle database and the database properties are specified in an application.properties file. I created a Docker image of the spring boot application with the plugin "com.google.cloud.tools.jib" and using the following command: ./gradlew jibDockerBuild --image=app1 I have a docker-compose file in which i specify the image as an service and i want the application to start when i run the command: "docker-compose up" The

what is this maven certification error indicates?

大憨熊 提交于 2021-02-08 08:27:19
问题 [ERROR] Non-resolvable parent POM for com.example:dynamoWork:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.0.RELEASE from/to artie (https://repo.maven.apache.org/maven2/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target and 'parent.relativePath' points at no local POM @ line 14, column 10 ->

how to resolve Spring boot @EnableAsync and @Async problem?

試著忘記壹切 提交于 2021-02-08 08:15:14
问题 my service: @Service public class ForgetService{ @Async public CompletableFuture<Object> getTokenService() { Map<String, Object> map = new HashMap<>(8); map.put("status", ErrorEnum.TOKEN_SUSSCESS.getStatus()); map.put("message", ErrorEnum.TOKEN_SUSSCESS.getMessage()); return CompletableFuture.completedFuture(map); } } my controller: @RestController public class ForgetController { private final ForgetService forgetService; @Autowired private ForgetController(ForgetService forgetService) { this

how to resolve Spring boot @EnableAsync and @Async problem?

风流意气都作罢 提交于 2021-02-08 08:14:11
问题 my service: @Service public class ForgetService{ @Async public CompletableFuture<Object> getTokenService() { Map<String, Object> map = new HashMap<>(8); map.put("status", ErrorEnum.TOKEN_SUSSCESS.getStatus()); map.put("message", ErrorEnum.TOKEN_SUSSCESS.getMessage()); return CompletableFuture.completedFuture(map); } } my controller: @RestController public class ForgetController { private final ForgetService forgetService; @Autowired private ForgetController(ForgetService forgetService) { this

Missing request header 'authToken' calling RestAPI method

為{幸葍}努か 提交于 2021-02-08 07:46:31
问题 I have this RestAPI method @GetMapping(path = "/menus", consumes = "application/json", produces = "application/json") public ResponseEntity<List<MenuPriceSummary>> allMenus(HttpServletRequest request, @RequestHeader(value="Authorization: Bearer") String authToken) { String username = jwtTokenUtil.getUsernameFromToken(authToken); User user = userService.findByUserName(username); return ResponseEntity.ok(menuService.allMenus(user)); } which I call from curl curl -X GET -H "Content-Type:

Missing request header 'authToken' calling RestAPI method

丶灬走出姿态 提交于 2021-02-08 07:46:00
问题 I have this RestAPI method @GetMapping(path = "/menus", consumes = "application/json", produces = "application/json") public ResponseEntity<List<MenuPriceSummary>> allMenus(HttpServletRequest request, @RequestHeader(value="Authorization: Bearer") String authToken) { String username = jwtTokenUtil.getUsernameFromToken(authToken); User user = userService.findByUserName(username); return ResponseEntity.ok(menuService.allMenus(user)); } which I call from curl curl -X GET -H "Content-Type:

Spring Kafka ChainedKafkaTransactionManager doesn't synchronize with JPA Spring-data transaction

狂风中的少年 提交于 2021-02-08 07:36:40
问题 I read a ton of Gary Russell answers and posts, but didn't find actual solution for the common use-case for synchronization of the sequence below: recieve from topic A => save to DB via Spring-data => send to topic B As i understand properly: there is no guarantee for fully atomic processing in that case and i need to deal with messages deduplication on the client side, but the main issue is that ChainedKafkaTransactionManager doesn't synchronize with JpaTransactionManager (see @KafkaListener

How to verify sprng kafka producer has successfully sent message or not?

懵懂的女人 提交于 2021-02-08 07:29:32
问题 I am trying to test spring kafka(2.2.5.RELEASE) where when producer send message with kafkatemplate, i like to know if that message was sent successfully or not. Based on that I would like to update the db record for that message id. What is the best practice to handle this scenario? Here is the sample code which checks success or failure ListenableFuture<SendResult<String, String>> future = kafkaTemplate.send("test_topic", key, userMsg); SendResult<String, String> result = null; try { result

Spring REST API multiple RequestParams vs controller implementation

血红的双手。 提交于 2021-02-08 07:22:42
问题 I'm wondering about proper way of implementating of controller in case of GET request with multiple request params given. In my understanding of REST it's much better to have one endpoint with additional parameters for filtering/sorting than several endpoints (one for each case). I'm just wondering about maintanance and extensibility of such endpoint. Please have a look on example below : @RestController @RequestMapping("/customers") public class CustomerController { @Autowired private

Spring REST API multiple RequestParams vs controller implementation

拥有回忆 提交于 2021-02-08 07:20:24
问题 I'm wondering about proper way of implementating of controller in case of GET request with multiple request params given. In my understanding of REST it's much better to have one endpoint with additional parameters for filtering/sorting than several endpoints (one for each case). I'm just wondering about maintanance and extensibility of such endpoint. Please have a look on example below : @RestController @RequestMapping("/customers") public class CustomerController { @Autowired private