spring-rest

Request not reaching to the controller but still get 200 response

。_饼干妹妹 提交于 2020-06-09 02:54:26
问题 I was playing around spring security and trying to secure an restful application, but then ran into this rather absurd problem. All the action on my controllers are fine and the requests are accepted but the request actually never reaches the controller and always 200 is returned with no content. My security config looks likes so: package com.bpawan.interview.api.config; import com.bpawan.interview.api.model.Error; import com.bpawan.interview.api.security.JWTAuthenticationFilter; import com

Spring REST and PATCH method

こ雲淡風輕ζ 提交于 2020-05-11 04:24:27
问题 I'm using SpringBoot and Spring REST. I would like to understand the HTTP PATCH method to update properties of my Model Is there any good tutorial explaining how to make it works ? HTTP PATCH method and body to be Send Controller method and how to manage the update operation 回答1: I've noticed that many of the provided answers are all JSON patching or incomplete answers. Below is a full explanation and example of what you need with functioning real world code First, PATCH is a selective PUT.

Spring REST and PATCH method

痴心易碎 提交于 2020-05-11 04:24:07
问题 I'm using SpringBoot and Spring REST. I would like to understand the HTTP PATCH method to update properties of my Model Is there any good tutorial explaining how to make it works ? HTTP PATCH method and body to be Send Controller method and how to manage the update operation 回答1: I've noticed that many of the provided answers are all JSON patching or incomplete answers. Below is a full explanation and example of what you need with functioning real world code First, PATCH is a selective PUT.

Java 8 to remove string value from each field where “string” value comes of the Custom Object

杀马特。学长 韩版系。学妹 提交于 2020-04-12 07:25:29
问题 I went through link: Is it possible in Java to check if objects fields are null and then add default value to all those attributes? and implemented the same solution as below - Note: I am using Swagger/Open API Specs (using springdoc-openapi-ui) and while making POST request all string fields are having default value as "string" which I really wanted to set it to null or space. Any quick pointer ? public static Object getObject(Object obj) { for (Field f : obj.getClass().getFields()) { f

How to get the current Request Mapping URL configured at Controller layer when request is executed?

老子叫甜甜 提交于 2020-03-21 06:52:07
问题 I went through so many links like How to show all controllers and mappings in a view and How to configure a default @RestController URI prefix for all controllers? and so on. I want to get the Request Mapping URL at Filter interceptor Ex: This URL I configured at REST controller method, and naturally we will pass /employees/employee-names/John to get the Employee John. /employees/employee-names/{employee_name} Now, when somebody hit /employees/employee-names/John I want to get the value of

@RestController methods seem to be Transactional by default, Why?

十年热恋 提交于 2020-03-17 10:32:26
问题 Using Spring boot 1.3.1 I don't understand why @RestController are Transactionnal by default. I haven't found anything saying so in the docs. Example which pushes this fact that the method findOne() in the controller below is Transactionnal: @RestController @RequestMapping("/books") public class BookController { @RequestMapping("/{id}") public Book findOne(@PathVariable Long id) { Book book = this.bookDao.findOneBookById(id); // following line // => triggers a select author0_.id as id1_0_0_

@RestController methods seem to be Transactional by default, Why?

谁说胖子不能爱 提交于 2020-03-17 10:32:26
问题 Using Spring boot 1.3.1 I don't understand why @RestController are Transactionnal by default. I haven't found anything saying so in the docs. Example which pushes this fact that the method findOne() in the controller below is Transactionnal: @RestController @RequestMapping("/books") public class BookController { @RequestMapping("/{id}") public Book findOne(@PathVariable Long id) { Book book = this.bookDao.findOneBookById(id); // following line // => triggers a select author0_.id as id1_0_0_

Read multiple properties file in one go using Spring Boot?

淺唱寂寞╮ 提交于 2020-02-25 05:26:38
问题 I went through the link: How to pass a Map<String, String> with application.properties and other related links multiple times, but still its not working. I'm using Spring Boot and Spring REST example. Link Question: How to by default execute the latest version of endpoint in Spring Boot REST?. I've created mapping something like this and simply read the mapping get.customers={GET: '/app-data/customers', VERSION: 'v1'} post.customers={POST: '/app-data/customers', VERSION: 'v1'} get.customers

Read multiple properties file in one go using Spring Boot?

对着背影说爱祢 提交于 2020-02-25 05:26:27
问题 I went through the link: How to pass a Map<String, String> with application.properties and other related links multiple times, but still its not working. I'm using Spring Boot and Spring REST example. Link Question: How to by default execute the latest version of endpoint in Spring Boot REST?. I've created mapping something like this and simply read the mapping get.customers={GET: '/app-data/customers', VERSION: 'v1'} post.customers={POST: '/app-data/customers', VERSION: 'v1'} get.customers

Spring Pageable does not translate @Column name

核能气质少年 提交于 2020-02-24 14:43:59
问题 I have Entity object : @Entity(name = "table") public class SomeEntity { @Id @Column(name = "id_column_name") public final BigDecimal entityId; @Column(name = "table_column_name") public final String entityFieldName; } And I have database view defined like this: CREATE OR REPLACE FORCE EDITIONABLE VIEW "V_TABLE" ("ID_COLUMN_NAME", "TABLE_COLUMN_NAME", "SOME_OTHER_COLUMN") AS ... (some SQL magic) And I have repository with custom query: @RepositoryRestResource interface SomeEntityRepository