spring-annotations

Logging elapsed time of execution in SpringBoot rest API

杀马特。学长 韩版系。学妹 提交于 2020-07-23 09:03:13
问题 It could be a simple solution but I am unable to get it done. I need to log the overall execution time for my request in SpringBoot Rest API. Request always enters to MainController always and can exit from two places- Main Restcontroller same method or ExceptionHandlerController handler method I have created one custom annotation and injecting it to both main Controller and ExceptionController methods and getting elapsed time for individual methods. So here is the problem. I need to add

Logging elapsed time of execution in SpringBoot rest API

不想你离开。 提交于 2020-07-23 09:02:06
问题 It could be a simple solution but I am unable to get it done. I need to log the overall execution time for my request in SpringBoot Rest API. Request always enters to MainController always and can exit from two places- Main Restcontroller same method or ExceptionHandlerController handler method I have created one custom annotation and injecting it to both main Controller and ExceptionController methods and getting elapsed time for individual methods. So here is the problem. I need to add

Spring Boot : Custom Validation in Request Params

六眼飞鱼酱① 提交于 2020-07-04 14:00:10
问题 I want to validate one of the request parameters in my controller . The request parameter should be from one of the list of given values , if not , an error should be thrown . In the below code , I want the request param orderBy to be from the list of values present in @ValuesAllowed. @RestController @RequestMapping("/api/opportunity") @Api(value = "Opportunity APIs") @ValuesAllowed(propName = "orderBy", values = { "OpportunityCount", "OpportunityPublishedCount", "ApplicationCount",

Spring Boot : Custom Validation in Request Params

心已入冬 提交于 2020-07-04 14:00:10
问题 I want to validate one of the request parameters in my controller . The request parameter should be from one of the list of given values , if not , an error should be thrown . In the below code , I want the request param orderBy to be from the list of values present in @ValuesAllowed. @RestController @RequestMapping("/api/opportunity") @Api(value = "Opportunity APIs") @ValuesAllowed(propName = "orderBy", values = { "OpportunityCount", "OpportunityPublishedCount", "ApplicationCount",

javax validation api not working for pojo validation

牧云@^-^@ 提交于 2020-06-01 05:11:27
问题 I have a POJO class where the class variables are getting injected by @Value annotation. I am trying to validate my class variables using javax validation api & so I have tried @NotNull , @NotEmpty and @NotBlank , but all of them seem not to be validating or throwing any kind of exception even when a blank/null value is present in the application.yml file. Any idea as to how can I validate my POJO here using the javax validation api? PS: I am using lombok to generate my getter/setter. Below

javax validation api not working for pojo validation

纵然是瞬间 提交于 2020-06-01 05:11:10
问题 I have a POJO class where the class variables are getting injected by @Value annotation. I am trying to validate my class variables using javax validation api & so I have tried @NotNull , @NotEmpty and @NotBlank , but all of them seem not to be validating or throwing any kind of exception even when a blank/null value is present in the application.yml file. Any idea as to how can I validate my POJO here using the javax validation api? PS: I am using lombok to generate my getter/setter. Below

Spring custom @Enable annotation meta-annotated with @ComponentScan

岁酱吖の 提交于 2020-05-26 05:30:30
问题 I'm trying to write my own @Enable annotation for Spring framework, which should be used as follows: package com.example.package.app; @SpringBootApplication @com.example.annotations.EnableCustom("com.example.package.custom") public class MyApplication {} I followed Component scan using custom annotation, but this poses several limitations: I cannot make the base package property dynamic, i.e. I cannot pass "com.example.package.base" , but need to pre-define the package at the configuration. I

Spring custom @Enable annotation meta-annotated with @ComponentScan

不打扰是莪最后的温柔 提交于 2020-05-26 05:30:16
问题 I'm trying to write my own @Enable annotation for Spring framework, which should be used as follows: package com.example.package.app; @SpringBootApplication @com.example.annotations.EnableCustom("com.example.package.custom") public class MyApplication {} I followed Component scan using custom annotation, but this poses several limitations: I cannot make the base package property dynamic, i.e. I cannot pass "com.example.package.base" , but need to pre-define the package at the configuration. I

Spring custom @Enable annotation meta-annotated with @ComponentScan

旧巷老猫 提交于 2020-05-26 05:29:45
问题 I'm trying to write my own @Enable annotation for Spring framework, which should be used as follows: package com.example.package.app; @SpringBootApplication @com.example.annotations.EnableCustom("com.example.package.custom") public class MyApplication {} I followed Component scan using custom annotation, but this poses several limitations: I cannot make the base package property dynamic, i.e. I cannot pass "com.example.package.base" , but need to pre-define the package at the configuration. I

Parameter 0 of constructor in required a bean of type 'java.lang.String' that could not be found

我的未来我决定 提交于 2020-05-25 16:58:48
问题 I am working on spring batch with spring boot 2.X application, actually its existing code i am checked out from git. While running the application it fails due to below error only for me and same code is working for others. s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inputItemReader' defined in file [C:\Users\XYZ\git