how to validate if there's already a field with the same registered number (Logical problem)

how to validate if there's already a field with the same registered number (Logical problem) Problem Description: (https://i.stack.imgur.com/52C98.png) I can’t let the user enter a code that already exists in the database,so i need to make one more validation for this field "code". obviously I have to use a ‘if statement’ but i just can’t … Read more

Spring Boot Test "Failed to load ApplicationContext"

Spring Boot Test "Failed to load ApplicationContext" Problem Description: I am getting an error while testing my rest application but can’t understand why.My error output: ava.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:98) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:124) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.prepareTestInstance(SpringBootDependencyInjectionTestExecutionListener.java:43) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:248) at org.springframework.test.context.junit.jupiter.SpringExtension.postProcessTestInstance(SpringExtension.java:138) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at … Read more

Found duplicate key in application.yml

Found duplicate key in application.yml Problem Description: I have been working on a kafka stream project I am new to yaml files I have been using application.properties . Basically I want to use kafka properties as well as spring fox properties here is my application.yml spring: cloud: function: definition: consumer;producer stream: kafka: bindings: producer-out-0: producer: … Read more

Field 'id' doesn't have a default value because of generated value

Field 'id' doesn't have a default value because of generated value Problem Description: My entities FoodItem.java @AllArgsConstructor @NoArgsConstructor @Builder @Entity @Setter @Getter @Table(name = "food_items", schema = "restaurant-service") @FieldDefaults(level = AccessLevel.PRIVATE) public class FoodItem { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long id; String name; BigDecimal price; Long restaurant_id; } Restaurant.java @AllArgsConstructor @NoArgsConstructor @Builder @Entity @Setter @Getter … Read more

Schema related problems with Flyway / Springboot and H2 in-memory database

Schema related problems with Flyway / Springboot and H2 in-memory database Problem Description: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT INTO merchant_rating_detail (order_id, shop_id, user_id, rating, created_datetime, feedback_ids) VALUES(?, ?, ?, ?, ?, ?);]; nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "merchant_rating_detail" not found (this database is empty); SQL statement: INSERT INTO merchant_rating_detail (order_id, shop_id, user_id, rating, created_datetime, … Read more

Is it possible to use lambda in SpEL inside @ConditionalOnExpression

Is it possible to use lambda in SpEL inside @ConditionalOnExpression Problem Description: Is it possible to use lambda for@ConditionalOnExpression in spring expression language (SpEL)? I have created the following SpEL condition via collection-selection which works fine for me. But I am not satisfied how it looks like. @ConditionalOnExpression("#{T(java.util.Arrays).asList(‘${app.sync.white-list}’).?[#this.toLowerCase() == ‘all’ or #this.toLowerCase() == ‘phone’].size() > … Read more

Is it possible to use lambda in SpEL inside @ConditionalOnExpression

Is it possible to use lambda in SpEL inside @ConditionalOnExpression Problem Description: Is it possible to use lambda for@ConditionalOnExpression in spring expression language (SpEL)? I have created the following SpEL condition via collection-selection which works fine for me. But I am not satisfied how it looks like. @ConditionalOnExpression("#{T(java.util.Arrays).asList(‘${app.sync.white-list}’).?[#this.toLowerCase() == ‘all’ or #this.toLowerCase() == ‘phone’].size() > … Read more

SpringToolSuite is unable to recognize spring boot annotations

SpringToolSuite is unable to recognize spring boot annotations Problem Description: I got a project from GitHub which is a Java spring boot application running with Maven dependencies. I am so confused why I can’t run the application successfully on STS. There’s no longer a problem on my old laptop. Because I just changed my laptop, … Read more

SpringToolSuite is unable to recognize spring boot annotations

SpringToolSuite is unable to recognize spring boot annotations Problem Description: I got a project from GitHub which is a Java spring boot application running with Maven dependencies. I am so confused why I can’t run the application successfully on STS. There’s no longer a problem on my old laptop. Because I just changed my laptop, … Read more

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject