spring-mvc

Using encrypted password for database connection in spring boot web application

不问归期 提交于 2020-08-10 06:11:20
问题 This might be already answered or asked by some one else already, but I am not able to find one which satisfies my use case. I am making a database connection in my spring boot web application(Note: My application is packaged as "WAR" and it does not contain the embedded tomcat) by specifying the following properties in my application.properties file. spring.datasource.driver-class-name=com.teradata.jdbc.TeraDriver spring.datasource.url=jdbc:teradata://localhost/database=test spring

Using encrypted password for database connection in spring boot web application

為{幸葍}努か 提交于 2020-08-10 06:11:03
问题 This might be already answered or asked by some one else already, but I am not able to find one which satisfies my use case. I am making a database connection in my spring boot web application(Note: My application is packaged as "WAR" and it does not contain the embedded tomcat) by specifying the following properties in my application.properties file. spring.datasource.driver-class-name=com.teradata.jdbc.TeraDriver spring.datasource.url=jdbc:teradata://localhost/database=test spring

how to pass Spring Pageable to FeignClient

旧巷老猫 提交于 2020-08-10 03:38:33
问题 as I wrote in this issue: https://github.com/spring-cloud/spring-cloud-openfeign/issues/375 and in this SO question: Spring data Pageable does not work with feign client I have some problems sending a Pageable object in a POST request containing a @requestbody element. First I tried sending the Pageable embedded in my RequestBody since it was generated as example when using springdoc-openapi-webmvc-core. Example: @PostMapping("/search") public Page<HelloDto> searchHellos(@RequestBody HelloDto

how to pass Spring Pageable to FeignClient

十年热恋 提交于 2020-08-10 03:38:15
问题 as I wrote in this issue: https://github.com/spring-cloud/spring-cloud-openfeign/issues/375 and in this SO question: Spring data Pageable does not work with feign client I have some problems sending a Pageable object in a POST request containing a @requestbody element. First I tried sending the Pageable embedded in my RequestBody since it was generated as example when using springdoc-openapi-webmvc-core. Example: @PostMapping("/search") public Page<HelloDto> searchHellos(@RequestBody HelloDto

Scope of @Configuration Class in spring

随声附和 提交于 2020-08-09 05:27:17
问题 We are having @Configuration class, but it doesn't contain any bean definition and as it is a legacy class written by someone i don't want to remove the @Configuration annotation even while there is no bean definition. Somehow i want to perform logic on shutdown hook of web application but somehow i am not able to get bean from context in the contextDestroyed() method so i want to use @PreDestroy on that @Configuration class. Does any one specify what is the default scope of the

Spring Boot: redirect from HTTP to HTTPS results in 405 error for PUT method

狂风中的少年 提交于 2020-08-07 04:19:26
问题 I have a problem very similar to this one: Redirect Post method HTTP -> HTTPS - HTTP Status 405 (Spring boot) Basically, I'm trying to make Spring Boot serve both HTTP and HTTPS with the redirection from HTTP to HTTPS. It works, but only for GET requests. If I perform PUT request, I get "Request method 'GET' not supported" error, so looks like my PUT request is being converted to GET request somewhere somehow. I tried both ways of configuring such redirect: define HTTPS connectivity in

When to choose @RequestParam over @PathVariable and vice-versa?

若如初见. 提交于 2020-08-05 05:55:53
问题 I know what @RequestParam does and what @PathVariable does on an individual note but my question is when building a URL, when should I go for @RequestParam and when for @PathVariable ? What are the pros and and cons of using both these annotations? I did go through this link When to go for @RequestParam and @PathVariable but did not get a satisfactory answer anywhere. 回答1: @PathVariable identifies the pattern that is used in the URI for the incoming request. Query args ( @RequestParam ) are

When to choose @RequestParam over @PathVariable and vice-versa?

一个人想着一个人 提交于 2020-08-05 05:55:09
问题 I know what @RequestParam does and what @PathVariable does on an individual note but my question is when building a URL, when should I go for @RequestParam and when for @PathVariable ? What are the pros and and cons of using both these annotations? I did go through this link When to go for @RequestParam and @PathVariable but did not get a satisfactory answer anywhere. 回答1: @PathVariable identifies the pattern that is used in the URI for the incoming request. Query args ( @RequestParam ) are

Spring RestController : reject request with unknown fields

余生长醉 提交于 2020-08-04 07:21:20
问题 I have the following endpoint : import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.web.bind.annotation.RequestMethod.POST; @RestController public class TestController { @RequestMapping(value = "/persons", method = POST, consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) public ResponseEntity<Integer> create(@RequestBody

Spring RestController : reject request with unknown fields

[亡魂溺海] 提交于 2020-08-04 07:20:38
问题 I have the following endpoint : import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.web.bind.annotation.RequestMethod.POST; @RestController public class TestController { @RequestMapping(value = "/persons", method = POST, consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) public ResponseEntity<Integer> create(@RequestBody