httpstatus | Easily generate different HTTP responses | HTTP library

 by   Readify C# Version: Current License: MIT

kandi X-RAY | httpstatus Summary

httpstatus is a C# library typically used in Networking, HTTP applications. httpstatus has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.
Easily generate different HTTP responses for testing
    Support
      Quality
        Security
          License
            Reuse
            Support
              Quality
                Security
                  License
                    Reuse

                      kandi-support Support

                        summary
                        httpstatus has a low active ecosystem.
                        summary
                        It has 366 star(s) with 55 fork(s). There are 81 watchers for this library.
                        summary
                        It had no major release in the last 6 months.
                        summary
                        There are 16 open issues and 37 have been closed. On average issues are closed in 106 days. There are no pull requests.
                        summary
                        It has a neutral sentiment in the developer community.
                        summary
                        The latest version of httpstatus is current.
                        httpstatus Support
                          Best in #HTTP
                            Average in #HTTP
                            httpstatus Support
                              Best in #HTTP
                                Average in #HTTP

                                  kandi-Quality Quality

                                    summary
                                    httpstatus has 0 bugs and 0 code smells.
                                    httpstatus Quality
                                      Best in #HTTP
                                        Average in #HTTP
                                        httpstatus Quality
                                          Best in #HTTP
                                            Average in #HTTP

                                              kandi-Security Security

                                                summary
                                                httpstatus has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
                                                summary
                                                httpstatus code analysis shows 0 unresolved vulnerabilities.
                                                summary
                                                There are 0 security hotspots that need review.
                                                httpstatus Security
                                                  Best in #HTTP
                                                    Average in #HTTP
                                                    httpstatus Security
                                                      Best in #HTTP
                                                        Average in #HTTP

                                                          kandi-License License

                                                            summary
                                                            httpstatus is licensed under the MIT License. This license is Permissive.
                                                            summary
                                                            Permissive licenses have the least restrictions, and you can use them in most projects.
                                                            httpstatus License
                                                              Best in #HTTP
                                                                Average in #HTTP
                                                                httpstatus License
                                                                  Best in #HTTP
                                                                    Average in #HTTP

                                                                      kandi-Reuse Reuse

                                                                        summary
                                                                        httpstatus releases are not available. You will need to build from source code and install.
                                                                        httpstatus Reuse
                                                                          Best in #HTTP
                                                                            Average in #HTTP
                                                                            httpstatus Reuse
                                                                              Best in #HTTP
                                                                                Average in #HTTP
                                                                                  Top functions reviewed by kandi - BETA
                                                                                  kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
                                                                                  Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
                                                                                  Get all kandi verified functions for this library.
                                                                                  Get all kandi verified functions for this library.

                                                                                  httpstatus Key Features

                                                                                  Easily generate different HTTP responses for testing

                                                                                  httpstatus Examples and Code Snippets

                                                                                  No Code Snippets are available at this moment for httpstatus.
                                                                                  Community Discussions

                                                                                  Trending Discussions on httpstatus

                                                                                  properties not loaded from external configuration, when additional config location is provided from command line
                                                                                  chevron right
                                                                                  Reply Channel for Messaging Gateway using Java DSL
                                                                                  chevron right
                                                                                  _CastError (type 'Null' is not a subtype of type 'List' in type cast) when having Network Image inside Listview
                                                                                  chevron right
                                                                                  How to loop through a list payload and insert into database as individual row items in Springboot?
                                                                                  chevron right
                                                                                  foreach not applicable to type 'java.lang.String'
                                                                                  chevron right
                                                                                  AXONIQ-4002 error while using Axon Framework with spring boot
                                                                                  chevron right
                                                                                  java abstract class for inheritance
                                                                                  chevron right
                                                                                  Get status code of Spring WebClient request
                                                                                  chevron right
                                                                                  @PreAuthorize("hasAuthority('String')") not working expectedly
                                                                                  chevron right
                                                                                  Exception while creating CRUD using Spring Boot + RestAPI + JPA + CrudRepository +MySQL
                                                                                  chevron right

                                                                                  QUESTION

                                                                                  properties not loaded from external configuration, when additional config location is provided from command line
                                                                                  Asked 2021-Jun-15 at 10:31

                                                                                  I am using spring-boot 2.2.7.RELEASE

                                                                                  In the controller I want to get some values from external config file. But the application does not start even though the properties are available in the external config.

                                                                                  could you suggest how to load only specific properties from external config.

                                                                                  NOTE: I also tried spring.config.additional-location, and it is not working

                                                                                  Thanks

                                                                                  Controller

                                                                                  import org.springframework.beans.factory.annotation.Value;
                                                                                  import org.springframework.http.HttpStatus;
                                                                                  import org.springframework.http.ResponseEntity;
                                                                                  import org.springframework.web.bind.annotation.GetMapping;
                                                                                  import org.springframework.web.bind.annotation.RequestMapping;
                                                                                  import org.springframework.web.bind.annotation.RestController;
                                                                                  
                                                                                  @RestController
                                                                                  @RequestMapping("/api")
                                                                                  public class ExternalPropTestController {
                                                                                  
                                                                                      @Value("${com.x.db.url}")
                                                                                      private String url;
                                                                                  
                                                                                      @Value("${com.x.db.secret}")
                                                                                      private String secret;
                                                                                  
                                                                                      @GetMapping("/")
                                                                                      public ResponseEntity greet() {
                                                                                          return new ResponseEntity<>(url+" : "+secret, HttpStatus.OK);
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  config.yml

                                                                                  com:
                                                                                    x:
                                                                                      db:
                                                                                        url: external url
                                                                                        secret: external secret
                                                                                  

                                                                                  Command to start the application

                                                                                  java -jar application.jar -Dspring-boot.run.arguments=--spring.config.location=file:///C://some-external-path//config//config.yml

                                                                                  Getting below error, while starting the application

                                                                                  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalPropTestController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'com.x.db.url' in value "${com.x.db.url}" at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at com.x.y.CrewDocServiceApp.main(CrewDocServiceApp.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'com.x.db.url' in value "${com.x.db.url}" at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178) at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236) at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:912) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1226) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ... 23 common frames omitted

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-15 at 10:31

                                                                                  As per documentation, SpringApplication converts any command line option arguments (that is, arguments starting with --, such as --server.port=9000) to a property and adds them to the Spring Environment.

                                                                                  -D works when running via maven. Try: java -jar application.jar --spring.config.location=file:///C://your//path//config.yml.

                                                                                  Via maven: mvn spring-boot:run -Dspring.config.location="file:///C://your//path//config.yml"

                                                                                  Source https://stackoverflow.com/questions/67982831

                                                                                  QUESTION

                                                                                  Reply Channel for Messaging Gateway using Java DSL
                                                                                  Asked 2021-Jun-14 at 14:28

                                                                                  I have a REST API which receives a POST request from a client application.

                                                                                  @Autowired
                                                                                  private EdiTranslationEvents.TransformToString transformToString;
                                                                                  
                                                                                  @PostMapping("/testPost")
                                                                                  @ResponseStatus(HttpStatus.OK)
                                                                                  public String testPostLogging(@RequestBody Student student) {
                                                                                      log.info("In controller....");
                                                                                      System.out.println(this.transformToString.objectToInputGateway(student));
                                                                                      return "testPost logging";
                                                                                  }
                                                                                  

                                                                                  As you can see, in the controller, I have an autowired messaging gateway and I am using it to send data to a channel.

                                                                                  @Configuration
                                                                                  @EnableIntegration
                                                                                  public class EdiTranslationEvents {
                                                                                  
                                                                                      @Component
                                                                                      @MessagingGateway
                                                                                      public interface TransformToString {
                                                                                  
                                                                                          @Gateway(requestChannel = "inputObjectChannel")
                                                                                          String objectToInputGateway(Student student);
                                                                                      }
                                                                                  
                                                                                      @Bean
                                                                                      public IntegrationFlow inputObjectString() {
                                                                                          return IntegrationFlows.from(inputObjectChannel())
                                                                                                  .transform(Transformers.objectToString())
                                                                                                  .log(LoggingHandler.Level.DEBUG, "com.dash.Logger")
                                                                                                  .get();
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  When I send data to the REST API, the API just hangs. The gateway does not return anything. I have the return type specified, and I was assuming that the gateway creates a temporary reply channel and sends the response to that channel.

                                                                                  However, I am not doing anything in the DSL configuration for creating or managing a reply. So, how do I send a reply back to the reply channel from the DSL flow?

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-14 at 14:28

                                                                                  Your current flow does not return a value, you are simply logging the message.

                                                                                  A terminating .log() ends the flow.

                                                                                  Delete the .log() element so the result of the transform will automatically be routed back to the gateway.

                                                                                  Or add a .bridge() (a bridge to nowhere) after the log and it will bridge the output to the reply channel.

                                                                                  Source https://stackoverflow.com/questions/67960788

                                                                                  QUESTION

                                                                                  _CastError (type 'Null' is not a subtype of type 'List' in type cast) when having Network Image inside Listview
                                                                                  Asked 2021-Jun-14 at 11:07

                                                                                  i have an error that i just dont find a solution for. I created a little messenger thingy in flutter and have a problem when using a NetworkImage inside one of my chat bubbles.

                                                                                  When i send the image as message, it is displayed without problem in the bubble. Also when i send multiple images, it is no problem and they extend beyond the screen and i can just scroll up and down without any problems.

                                                                                  Though when i reopen the room screen and there are multiple images and they extend over the visible screen i get _CastError (type 'Null' is not a subtype of type 'List' in type cast) from network_image dart file. BUT this only happens after a hot restart. If i just navigate back and then reopen the room screen its also all fine, but as soon as i hot restarted once i always get the error when trying to open a room, which has images extending the visible space.

                                                                                  Iam still kinda new to flutter, so i know my code sucks mostly but this time i just dont even find a "dirty" way to solve it.

                                                                                  Flutter 2.2.0 (beta channel)
                                                                                  Dart 2.13.0 On Android Emulator Pixel 4a API 30

                                                                                  Edit 1: i removed a lot to make it easier to read.

                                                                                  Edit 2: i found it to be somehow connected to using the downloadURL from Firebase Storage. When i replace the url with just some test png url it doesnt seem to be a problem.

                                                                                  import 'package:bubble/bubble.dart';
                                                                                  import 'package:cloud_firestore/cloud_firestore.dart';
                                                                                  import 'package:flutter/material.dart';
                                                                                  import 'package:flutter_riverpod/flutter_riverpod.dart';
                                                                                  import 'package:app/src/app/provider/firestore_provider.dart';
                                                                                  
                                                                                  class MessageRoomCopy extends ConsumerWidget {
                                                                                    final String roomName;
                                                                                    final String roomID;
                                                                                    MessageRoomCopy(this.roomName, this.roomID);
                                                                                  
                                                                                    @override
                                                                                    Widget build(BuildContext context, ScopedReader watch) {
                                                                                      final firestoreServ = watch(firestoreServiceProvider);
                                                                                      return Scaffold(
                                                                                        backgroundColor: Color(0xFFECE5DD),
                                                                                        appBar: AppBar(title: Text("$roomName", style: TextStyle(color: Colors.white))),
                                                                                        body: StreamBuilder(
                                                                                            stream: firestoreServ.messagesOfRoom("$roomID"),
                                                                                            builder: (BuildContext context, AsyncSnapshot>> snapshot) {
                                                                                              if (snapshot.hasError) {
                                                                                                return Center(
                                                                                                  child: Text("Error"),
                                                                                                );
                                                                                              } else if (snapshot.connectionState == ConnectionState.waiting) {
                                                                                                return Center(child: CircularProgressIndicator());
                                                                                              } else {
                                                                                                final List>> messagesList = snapshot.data!.docs;
                                                                                  
                                                                                                return ListView.separated(
                                                                                                  reverse: true,
                                                                                                  //shrinkWrap: true,
                                                                                                  itemBuilder: (BuildContext context, int index) {
                                                                                                    var _messageBubble;
                                                                                                    double? _elevation = 2.0;
                                                                                                    BubbleEdges? _margin = BubbleEdges.only(top: 10);
                                                                                                    BubbleNip? _nip = BubbleNip.rightTop;
                                                                                                    bool? _showNip = true;
                                                                                                    Alignment? _alignment = Alignment.topRight;
                                                                                                    Color? _color = Color.fromRGBO(225, 255, 199, 1.0);
                                                                                                    Widget? _messageChild;
                                                                                  
                                                                                                    if (messagesList[index].get("messagetype") == "text") {
                                                                                                      _messageChild = Text(
                                                                                                        messagesList[index].get("content"),
                                                                                                        style: Theme.of(context).textTheme.bodyText2,
                                                                                                      );
                                                                                                    } else if (messagesList[index].get("messagetype") == "image") {
                                                                                                      _messageChild = Image.network(
                                                                                                        messagesList[index].get("content"),
                                                                                                        errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
                                                                                                          return Text("Error Wdiget");
                                                                                                        },
                                                                                                      );
                                                                                                    }
                                                                                  
                                                                                                    _messageBubble = Bubble(
                                                                                                      elevation: _elevation,
                                                                                                      margin: _margin,
                                                                                                      nip: _nip,
                                                                                                      showNip: _showNip,
                                                                                                      alignment: _alignment,
                                                                                                      color: _color,
                                                                                                      child: _messageChild,
                                                                                                    );
                                                                                  
                                                                                                    return Container(
                                                                                                      child: Column(
                                                                                                        children: [
                                                                                                          _messageBubble,
                                                                                                        ],
                                                                                                      ),
                                                                                                    );
                                                                                                  },
                                                                                                  separatorBuilder: (BuildContext context, int index) => Divider(
                                                                                                    height: 1,
                                                                                                    color: Colors.transparent,
                                                                                                  ),
                                                                                                  itemCount: messagesList.length,
                                                                                                );
                                                                                              }
                                                                                            }),
                                                                                      );
                                                                                    }
                                                                                  }
                                                                                  

                                                                                  Also this is where the error rethrow is coming from inside _network_image_io.dart

                                                                                  Future _loadAsync(
                                                                                      NetworkImage key,
                                                                                      StreamController chunkEvents,
                                                                                      image_provider.DecoderCallback decode,
                                                                                    ) async {
                                                                                      try {
                                                                                        assert(key == this);
                                                                                  
                                                                                        final Uri resolved = Uri.base.resolve(key.url);
                                                                                  
                                                                                        final HttpClientRequest request = await _httpClient.getUrl(resolved);
                                                                                  
                                                                                        headers?.forEach((String name, String value) {
                                                                                          request.headers.add(name, value);
                                                                                        });
                                                                                        final HttpClientResponse response = await request.close();
                                                                                        if (response.statusCode != HttpStatus.ok) {
                                                                                          // The network may be only temporarily unavailable, or the file will be
                                                                                          // added on the server later. Avoid having future calls to resolve
                                                                                          // fail to check the network again.
                                                                                          await response.drain>();
                                                                                          throw image_provider.NetworkImageLoadException(statusCode: response.statusCode, uri: resolved);
                                                                                        }
                                                                                  
                                                                                        final Uint8List bytes = await consolidateHttpClientResponseBytes(
                                                                                          response,
                                                                                          onBytesReceived: (int cumulative, int? total) {
                                                                                            chunkEvents.add(ImageChunkEvent(
                                                                                              cumulativeBytesLoaded: cumulative,
                                                                                              expectedTotalBytes: total,
                                                                                            ));
                                                                                          },
                                                                                        );
                                                                                        if (bytes.lengthInBytes == 0)
                                                                                          throw Exception('NetworkImage is an empty file: $resolved');
                                                                                  
                                                                                        return decode(bytes);
                                                                                      } catch (e) {
                                                                                        // Depending on where the exception was thrown, the image cache may not
                                                                                        // have had a chance to track the key in the cache at all.
                                                                                        // Schedule a microtask to give the cache a chance to add the key.
                                                                                        scheduleMicrotask(() {
                                                                                          PaintingBinding.instance!.imageCache!.evict(key);
                                                                                        });
                                                                                        rethrow; // here this one
                                                                                      } finally {
                                                                                        chunkEvents.close();
                                                                                      }
                                                                                    }
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-14 at 11:07

                                                                                  Ok, i kind of found the problem. I took the Firebase servertimestamp as variable for the filename in the Firebase Storage. That of course only resulted in the filename being

                                                                                  FieldValue(Instance of 'MethodChannelFieldValue')

                                                                                  Though i dont really understand why that was a problem, but now with a normal Datetime toString timestamp it all works perfectly fine. Maybe its some special character escaping in the generated downloadURL from Firebase Storage with this kind of filename.

                                                                                  Source https://stackoverflow.com/questions/67909411

                                                                                  QUESTION

                                                                                  How to loop through a list payload and insert into database as individual row items in Springboot?
                                                                                  Asked 2021-Jun-13 at 20:14

                                                                                  I am trying to insert items in a list in a database as single values in rows with the name of the sender. I am able to send the payload and insert into a single row with the user detailst. How can I loop through the payload sent and insert all the items into individual rows? I have tried to look for examples no luck. So far I can only insert as a single row in the database

                                                                                  this is the payload

                                                                                  {"labsigned":["234568","234567","2345678","2344556","12335677","2345677","234556","234545"]}
                                                                                  

                                                                                  My controller

                                                                                  @RequestMapping(path = "/labreport/createrordispatched", method = RequestMethod.POST)
                                                                                  public ResponseEntity createDispatched(@RequestBody Dispatched dispatched){
                                                                                      if(labDashboardService.createDispatched(dispatched)) {
                                                                                          return ResponseEntity.status(HttpStatus.CREATED).body(true);
                                                                                      }
                                                                                  
                                                                                      return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(false);
                                                                                  }
                                                                                  

                                                                                  My Service

                                                                                   public boolean createDispatched(Dispatched dispatched) {
                                                                                  
                                                                                  
                                                                                          dispatched.setCreatedBy(getCurrentUserEmail());
                                                                                          dispatched.setDateCreated(System.currentTimeMillis());
                                                                                  
                                                                                          Dispatched ticket = new Dispatched(
                                                                                                  dispatched.getCreatedBy(),
                                                                                                  dispatched.getDateCreated(),
                                                                                                  dispatched.getlabsigned()
                                                                                          );
                                                                                  
                                                                                          dispatchedRepository.save(ticket);
                                                                                          return false;
                                                                                      }
                                                                                  

                                                                                  My Model

                                                                                  @Entity
                                                                                  @Table(name = "DISPATCHED")
                                                                                  public class Dispatched {
                                                                                      private String id;
                                                                                      private String labsigned;
                                                                                      private Long dateCreated;
                                                                                      private String createdBy;
                                                                                  
                                                                                      public Dispatched(){}
                                                                                      public Dispatched(String createdBy, Long dateCreated, String labsigned){
                                                                                          this.labsigned = rorlabsigned;
                                                                                          this.dateCreated = dateCreated;
                                                                                          this.createdBy = createdBy;
                                                                                  
                                                                                      }
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-13 at 20:14

                                                                                  Just send in a list of those values. Shouldn't have to be wrapped in a named field on an object. Just send it in as a json array like ["234568","234567","2345678","2344556","12335677","2345677","234556","234545"]. In your controller method, body don't pass it in as Dispatched but instead a List and then just loop through those creating a list of Dispatch objects and then using saveAll in the repository passing in the newly created Dispatched list.

                                                                                  Update: Example without actually compiling. Should be good enough for the example. Also using lombok to make it easier to read and a few other updates.

                                                                                  @AllArgsConstructor
                                                                                  @FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
                                                                                  @RestController
                                                                                  public class DispatchController {
                                                                                      
                                                                                      DispatchedEntityFactory dispatchedEntityFactory;
                                                                                      DispatchedRepository dispatchedRepository;
                                                                                      
                                                                                      @PostMapping("/labreport/createrordispatched")
                                                                                      public ResponseEntity createDispatched(DispatchedRequest dispatchedRequests){
                                                                                          List dispatchedEntities = dispatchedEntityFactory.creatMultipleFromDispatchRequest(dispatchedRequests);
                                                                                          
                                                                                          if(CollectionUtils.isEmpty(dispatchedEntities)) {
                                                                                              return ResponseEntity.badRequest().body(false);
                                                                                          }
                                                                                          
                                                                                          dispatchedRepository.saveAll(dispatchedEntities);
                                                                                          
                                                                                          return ResponseEntity.ok(true);
                                                                                      }
                                                                                  
                                                                                  }
                                                                                  
                                                                                  @Value
                                                                                  public class DispatchedRequest {
                                                                                  
                                                                                      String id;
                                                                                      Listlabsigned;
                                                                                      Long dateCreated;
                                                                                      String createdBy;
                                                                                  }
                                                                                  
                                                                                  @Entity
                                                                                  @Table(name = "DISPATCHED")
                                                                                  @Data
                                                                                  @FieldDefaults(level = AccessLevel.PRIVATE)
                                                                                  public class DispatchedEntity {
                                                                                      String id;
                                                                                      String labsigned;
                                                                                      Long dateCreated;
                                                                                      String createdBy;
                                                                                  }
                                                                                  
                                                                                  @Component
                                                                                  public class DispatchedEntityFactory {
                                                                                  
                                                                                      public List creatMultipleFromDispatchRequest(final DispatchedRequest dispatchedRequest) {
                                                                                          List dispatchedEntities = new ArrayList();
                                                                                          
                                                                                          for(String labsignature : dispatchedRequest.getLabsigned()) {
                                                                                              DispatchedEntity dispatchedEntity = new DispatchedEntity(dispatchedRequest.getId(),labsignature, dispatchedRequest.getDateCreated(), dispatchedRequest.getCreatedBy());
                                                                                              dispatchedEntities.add(dispatchedEntity);
                                                                                          }
                                                                                          
                                                                                          return dispatchedEntities;
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/67928459

                                                                                  QUESTION

                                                                                  foreach not applicable to type 'java.lang.String'
                                                                                  Asked 2021-Jun-13 at 11:54

                                                                                  I am trying to insert items in a list in a database as single values in rows. How can I loop through the payload sent and insert all the items into individual rows? I have tried to look for examples no luck. I cannot loop and insert the values in the database.

                                                                                  this is the payload

                                                                                  {"labsigned":["234568","234567","2345678","2344556","12335677","2345677","234556","234545"]}
                                                                                  

                                                                                  My controller

                                                                                  @RequestMapping(path = "/labreport/createrordispatched", method = RequestMethod.POST)
                                                                                  public ResponseEntity createDispatched(@RequestBody Dispatched dispatched){
                                                                                      if(labDashboardService.createDispatched(dispatched)) {
                                                                                          return ResponseEntity.status(HttpStatus.CREATED).body(true);
                                                                                      }
                                                                                  
                                                                                      return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(false);
                                                                                  }
                                                                                  

                                                                                  My Service

                                                                                  public boolean createDispatched(Dispatched dispatched) {
                                                                                      List newTickets = new ArrayList<>();
                                                                                  
                                                                                      dispatched.setCreatedBy(getCurrentUserEmail());
                                                                                      dispatched.setDateCreated(System.currentTimeMillis());
                                                                                  
                                                                                      for(String labsigned:dispatched.getlabsigned()){
                                                                                          Dispatched ticket = new Dispatched(
                                                                                                  dispatched.getCreatedBy(),
                                                                                                  dispatched.getDateCreated(),
                                                                                                  labsigned
                                                                                          );
                                                                                          newTickets.add(ticket);
                                                                                      }
                                                                                      dispatchedRepository.saveAll(newTickets);
                                                                                      return true;
                                                                                  }
                                                                                  

                                                                                  My Model

                                                                                  @Entity
                                                                                  @Table(name = "DISPATCHED")
                                                                                  public class Dispatched {
                                                                                      private String id;
                                                                                      private String labsigned;
                                                                                      private Long dateCreated;
                                                                                      private String createdBy;
                                                                                  
                                                                                      public Dispatched(){}
                                                                                      public Dispatched(String createdBy, Long dateCreated, String labsigned){
                                                                                          this.labsigned = rorlabsigned;
                                                                                          this.dateCreated = dateCreated;
                                                                                          this.createdBy = createdBy;
                                                                                  
                                                                                      }
                                                                                  //getters and setters
                                                                                  

                                                                                  the line that is giving me an error

                                                                                    for(String rorlabsigned:dispatched.getRorlabsigned())
                                                                                  

                                                                                  How should I set my entity to accept arrays?

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-13 at 09:01

                                                                                  The error message indicates that your getter dispatched.getRorlabsigned() does not return a Collection. It returns a single String instead. You can't loop over a String using foreach. I guess you need a Set there. Try to refactor that part of your code.

                                                                                  Source https://stackoverflow.com/questions/67956486

                                                                                  QUESTION

                                                                                  AXONIQ-4002 error while using Axon Framework with spring boot
                                                                                  Asked 2021-Jun-12 at 12:40

                                                                                  I am invoking the CommandGateway.send method from my rest controller but the control is not going into the Aggregate class and after 5 mins 500 internal server error is coming. When i debugged the application I found the below error is thrown by Axon ->

                                                                                  AxonServerRemoteCommandHandlingException{message=An exception was thrown by the remote message handling component: , errorCode='AXONIQ-4002', server=''}

                                                                                  Below are my Java files :

                                                                                  The Rest controller ->

                                                                                  @RestController
                                                                                  @RequestMapping("/product")
                                                                                  public class ProductController {
                                                                                  
                                                                                  @Autowired
                                                                                  private CommandGateway gateway;
                                                                                  
                                                                                  @PostMapping
                                                                                  public ResponseEntity createProduct(@RequestBody CreateProductModel model) {
                                                                                      
                                                                                      CreateProductCommand command=CreateProductCommand.builder()
                                                                                              .price("$123")
                                                                                              .productId(UUID.randomUUID().toString())
                                                                                              .product("Shoe")
                                                                                              .build();
                                                                                      
                                                                                      String s=gateway.sendAndWait(command);
                                                                                      
                                                                                      return new ResponseEntity(HttpStatus.CREATED);
                                                                                  }
                                                                                  

                                                                                  The ProductCreatedEvent object ->

                                                                                  import lombok.Data;
                                                                                  
                                                                                  @Data
                                                                                  public class ProductCreatedEvent {
                                                                                  @TargetAggregateIdentifier
                                                                                  private  String productId;
                                                                                  private  String product;
                                                                                  private  String price ;
                                                                                  

                                                                                  }

                                                                                  The command class CreateProductCommand ->

                                                                                  @Builder
                                                                                  @Data
                                                                                  public class CreateProductCommand {
                                                                                  @TargetAggregateIdentifier
                                                                                  private final String productId;
                                                                                  private final String product;
                                                                                  private final String price ;
                                                                                  

                                                                                  }

                                                                                  The Aggregate class ->

                                                                                  @Aggregate
                                                                                  public class ProductAggregate {
                                                                                  
                                                                                  @AggregateIdentifier
                                                                                  private  String productId;
                                                                                  private  String product;
                                                                                  private  String price ;
                                                                                  
                                                                                  public ProductAggregate() {
                                                                                      
                                                                                  }
                                                                                  
                                                                                  @CommandHandler
                                                                                  public ProductAggregate(CreateProductCommand command) {
                                                                                      //TODO: Validation logic can be handled here
                                                                                      ProductCreatedEvent event=new ProductCreatedEvent();
                                                                                      
                                                                                      BeanUtils.copyProperties(command, event);
                                                                                      AggregateLifecycle.apply(event);
                                                                                  }
                                                                                  
                                                                                  @EventSourcingHandler
                                                                                  public void on(ProductCreatedEvent event) {
                                                                                      this.price=event.getPrice();
                                                                                      this.productId=event.getProductId();
                                                                                      this.product=event.getProduct();
                                                                                      
                                                                                  }
                                                                                  
                                                                                  }
                                                                                  

                                                                                  Also i am using the below axon spring boot starter :

                                                                                      
                                                                                          org.axonframework
                                                                                          axon-spring-boot-starter
                                                                                          4.4.7
                                                                                      
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-12 at 12:40

                                                                                  This is resolved. I had to exclude the axon-server-connector dependency from the below axon-spring starter

                                                                                          
                                                                                          org.axonframework
                                                                                          axon-spring-boot-starter
                                                                                          4.0.3
                                                                                          
                                                                                              
                                                                                                  org.axonframework
                                                                                                  axon-server-connector
                                                                                              
                                                                                          
                                                                                      
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/67856373

                                                                                  QUESTION

                                                                                  java abstract class for inheritance
                                                                                  Asked 2021-Jun-12 at 01:22

                                                                                  I have a project where I am currently loading the records from the excel file to the database using from org.apache.poi

                                                                                  I have 3 kinds of files that I am loading into different Dto classes. Two of these dtos shares the same base class (they have common attributes)

                                                                                  @Getter
                                                                                  @Setter
                                                                                  @ToString
                                                                                  public class PpyRecordDTO {
                                                                                  
                                                                                  private String units;
                                                                                  private Double quantity;
                                                                                  
                                                                                  }
                                                                                  
                                                                                  @Getter
                                                                                  @Setter
                                                                                  @ToString
                                                                                  public class FirstRecordDTO extends RecordDTO {
                                                                                  private String normDescription;
                                                                                  private String relatedUnits;
                                                                                  
                                                                                  }
                                                                                  
                                                                                  
                                                                                  @Getter
                                                                                  @Setter
                                                                                  @ToString
                                                                                  public class SecondRecordDTO extends RecordDTO{
                                                                                  
                                                                                  private String normName;
                                                                                  }
                                                                                  
                                                                                  @Getter
                                                                                  @Setter
                                                                                  @ToString
                                                                                  public class ThirdRecordDTO {
                                                                                  
                                                                                  private String code;
                                                                                  }
                                                                                  

                                                                                  The ThirdRecordDto class has a unique attribute and no shared attributes with the base dto class RecordDTO

                                                                                  I want to return from this method the base class : RecordDto (But ThirdRecordDTO cannot extend it since there are no common fields)

                                                                                      public static List readPpyExcelFile(MultipartFile file, SourceType sourceType){
                                                                                      //TODO: making readPpyExcelFile generic
                                                                                      try {
                                                                                          Workbook workbook = WorkbookFactory.create(new BufferedInputStream(file.getInputStream()));
                                                                                  
                                                                                          Sheet sheet = workbook.getSheetAt(0);
                                                                                          Iterator rows = sheet.iterator();
                                                                                  
                                                                                          List lstRecords = processRecords(rows, sourceType);
                                                                                  
                                                                                          // Close WorkBook
                                                                                          workbook.close();
                                                                                  
                                                                                          return lstRecords;
                                                                                      } catch(ApiGenericException apiException){
                                                                                          throw new ApiGenericException(apiException.getStatus(), apiException.getMessage(), apiException.getErrorType());
                                                                                      } catch (Exception e) {
                                                                                          logger.error(e.getMessage());
                                                                                          throw new ApiGenericException(HttpStatus.INTERNAL_SERVER_ERROR,"Enable while loading the file", ApiErrorType.Unhandled
                                                                                          );
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  Is there a way to make the dto ThirdRecordDto also be returned or inherit from an abstract class which is shared by the other dtos in order to return the type

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-12 at 01:22

                                                                                  In general you can go with something like this:

                                                                                  public interface Ppy {
                                                                                   // common methods if any
                                                                                  }
                                                                                  
                                                                                  public class PpyRecordDTO implements Ppy{...}
                                                                                  public class FirstRecordDTO extends PpyRecordDTO {...} // so that it also implements Ppy interface
                                                                                  public class SecondRecordDTO extends PpyRecordDTO {...} // the same as above
                                                                                  public class ThirdRecordDTO implements Ppy {...} // Note, it doesn't extend PpyRecordDTO but implements the interface
                                                                                  

                                                                                  Now in the method, it's possible to:

                                                                                   public static List readPpyExcelFile(MultipartFile file, SourceType sourceType){...}
                                                                                  

                                                                                  This will work, however, you should ask yourself the following: what will do the code that will call this method, namely how it will differentiate between the different implementations? If the interface has a common method that makes sense for all implementations - fine, it will be able to call the method. For example, if it has a method like render(Page) or something, the code might be:

                                                                                  List ppis = readPpyExcelFile(...);
                                                                                  Page page = ...
                                                                                  for(Ppy ppi : ppis) {
                                                                                      ppi.render(page);
                                                                                  } 
                                                                                  

                                                                                  However, if the interface doesn't have any common methods - it won't help much. Inheritance is used when the child object can be viewed as a specialization of Parent (so that the child "is a" parent). So think whether inheritance is really appropriate here, assuming ThirdRecordDTO doesn't have anything in common with the rest of the classes.

                                                                                  Source https://stackoverflow.com/questions/67944751

                                                                                  QUESTION

                                                                                  Get status code of Spring WebClient request
                                                                                  Asked 2021-Jun-11 at 21:54

                                                                                  My goal is to get the HttpStatus from a Spring WebClient request. All other information of the request is irrelevant.

                                                                                  My old way of doing this was:

                                                                                  WebClient.builder().baseUrl("url").build()
                                                                                          .get().exchange().map(ClientResponse::statusCode).block();
                                                                                  

                                                                                  With Spring Boot 2.4.x/Spring 5.3, the exchange method of WebClient is deprecated in favor of retrieve.

                                                                                  With the help of https://stackoverflow.com/a/65791800 i managed to create the following solution.

                                                                                  WebClient.builder().baseUrl("url").build()
                                                                                          .get().retrieve()
                                                                                          .toEntity(String.class)
                                                                                          .flatMap(entity -> Mono.just(entity.getStatusCode()))
                                                                                          .block();
                                                                                  

                                                                                  However, this looks like a very "hacky" way and and does not work when 4xx or 5xx responses are received (In this case the result is null).

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-11 at 21:54

                                                                                  This problem can be solved with the method exchangeToMono. This results into the following snippet.

                                                                                  WebClient.builder().baseUrl("url").build()
                                                                                          .get().exchangeToMono(response -> Mono.just(response.statusCode()))
                                                                                          .block();
                                                                                  

                                                                                  The usage of the retrieve method can be improved in the following way, still not very clean.

                                                                                  WebClient.builder().baseUrl("url").build()
                                                                                          .get().retrieve()
                                                                                          .onStatus(httpStatus -> true, clientResponse -> {
                                                                                              //Set variable to return here
                                                                                              status.set(clientResponse.statusCode());
                                                                                              return null;
                                                                                          })
                                                                                          .toBodilessEntity().block();
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/67943438

                                                                                  QUESTION

                                                                                  @PreAuthorize("hasAuthority('String')") not working expectedly
                                                                                  Asked 2021-Jun-11 at 12:43

                                                                                  I have created the Spring Security configuration as it's below:

                                                                                  @EnableWebSecurity
                                                                                  public class SecurityConfigurer extends WebSecurityConfigurerAdapter{
                                                                                      @Override
                                                                                      protected void configure(HttpSecurity http) throws Exception {
                                                                                          http
                                                                                              .csrf().disable()
                                                                                              .authorizeRequests()
                                                                                                  .antMatchers("/Login").permitAll()
                                                                                                  .anyRequest().authenticated()
                                                                                                  .and()
                                                                                              .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
                                                                                          http
                                                                                              .addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class);
                                                                                      }
                                                                                  
                                                                                      @Override
                                                                                      @Bean
                                                                                      public AuthenticationManager authenticationManagerBean() throws Exception {
                                                                                          return super.authenticationManagerBean();
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  And each user has their own role/authority as of this:

                                                                                  public enum TypeEnum implements GrantedAuthority {
                                                                                      CUSTOMER("Customer"),
                                                                                      
                                                                                      EMPLOYEE("Employee");
                                                                                  
                                                                                      private String value;
                                                                                  
                                                                                      TypeEnum(String value) {
                                                                                        this.value = value;
                                                                                      }
                                                                                  
                                                                                      @Override
                                                                                      @JsonValue
                                                                                      public String toString() {
                                                                                        return String.valueOf(value);
                                                                                      }
                                                                                  
                                                                                      @JsonCreator
                                                                                      public static TypeEnum fromValue(String text) {
                                                                                        for (TypeEnum b : TypeEnum.values()) {
                                                                                          if (String.valueOf(b.value).equals(text)) {
                                                                                            return b;
                                                                                          }
                                                                                        }
                                                                                        return null;
                                                                                      }
                                                                                  
                                                                                      @Override
                                                                                      public String getAuthority() {
                                                                                        return name();
                                                                                  
                                                                                  

                                                                                  In my controller I am trying to pre-authorize it with certain roles

                                                                                  @PreAuthorize("hasAuthority('Employee')")
                                                                                  public ResponseEntity> getUsers(@Parameter(in = ParameterIn.QUERY, description = "Get user that corresponds to userID"
                                                                                          ,schema=@Schema()) @Valid @RequestParam(value = "userid", required = false) Integer userid,
                                                                                                                             @Parameter(in = ParameterIn.QUERY, description = "Get user that has account with IBAN" ,
                                                                                                                                     schema=@Schema()) @Valid @RequestParam(value = "iban", required = false) Integer iban,
                                                                                                                             @Parameter(in = ParameterIn.QUERY, description = "Get users based on Last Name" ,
                                                                                                                                     schema=@Schema()) @Valid @RequestParam(value = "lastname", required = false) String lastname,
                                                                                                                             @Parameter(in = ParameterIn.QUERY, description = "Maximum numbers of items to return" ,
                                                                                                                                     schema=@Schema()) @Valid @RequestParam(value = "limit", required = false) Integer limit)
                                                                                  {
                                                                                      return new ResponseEntity>(userService.getAllUser(), HttpStatus.OK);
                                                                                  }
                                                                                  

                                                                                  I printed the getAuthorities method

                                                                                  System.out.println(SecurityContextHolder.getContext().getAuthentication().getAuthorities());
                                                                                  

                                                                                  Which resulting in Customer

                                                                                  When I try to access the endpoint, it still shows the results and give status 200.

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-11 at 12:43

                                                                                  I think you should add @EnableGlobalMethodSecurity(prePostEnabled = true) annotation to your security config to be able to use hasAuthority() method.

                                                                                  @EnableWebSecurity
                                                                                  @EnableGlobalMethodSecurity(prePostEnabled = true)
                                                                                  public class SecurityConfigurer extends WebSecurityConfigurerAdapter{
                                                                                      @Override
                                                                                      protected void configure(HttpSecurity http) throws Exception {
                                                                                          
                                                                                         http
                                                                                              .csrf().disable()
                                                                                              .authorizeRequests()
                                                                                              .antMatchers("/Login").permitAll()
                                                                                              .anyRequest().authenticated()
                                                                                              .and()
                                                                                              .sessionManagement()
                                                                                              .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
                                                                                  
                                                                                         http
                                                                                              .addFilterBefore(jwtRequestFilter, 
                                                                                                               UsernamePasswordAuthenticationFilter.class);
                                                                                      }
                                                                                  
                                                                                      @Override
                                                                                      @Bean
                                                                                      public AuthenticationManager authenticationManagerBean() throws 
                                                                                                                                               Exception {
                                                                                          return super.authenticationManagerBean();
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/67928067

                                                                                  QUESTION

                                                                                  Exception while creating CRUD using Spring Boot + RestAPI + JPA + CrudRepository +MySQL
                                                                                  Asked 2021-Jun-11 at 07:41

                                                                                  I am trying to create my first project movie repository using Spring Boot + RestAPI + JPA + CrudRepository +MySQL.I am getting huge stack trace which is very difficult to understand.

                                                                                  Entity class:

                                                                                  package com.it.skill.movies;
                                                                                  
                                                                                  import javax.persistence.Column;
                                                                                  import javax.persistence.Entity;
                                                                                  import javax.persistence.Id;
                                                                                  import javax.persistence.Table;
                                                                                  
                                                                                  @Entity
                                                                                  @Table(name="movie")
                                                                                  public class Movie {
                                                                                  
                                                                                      @Id
                                                                                      private String mNo;
                                                                                      @Column
                                                                                      private String mName;
                                                                                      @Column
                                                                                      private Integer rating;
                                                                                      @Column
                                                                                      private String genre;
                                                                                      
                                                                                      public Movie() {}
                                                                                      
                                                                                      public Movie(String mNo, String mName, int rating, String genre) {
                                                                                          super();
                                                                                          this.mNo = mNo;
                                                                                          this.mName = mName;
                                                                                          this.rating = rating;
                                                                                          this.genre = genre;
                                                                                      }
                                                                                      public String getmNo() {
                                                                                          return mNo;
                                                                                      }
                                                                                      public void setmNo(String mNo) {
                                                                                          this.mNo = mNo;
                                                                                      }
                                                                                      public String getmName() {
                                                                                          return mName;
                                                                                      }
                                                                                      public void setmName(String mName) {
                                                                                          this.mName = mName;
                                                                                      }
                                                                                      public int getRating() {
                                                                                          return rating;
                                                                                      }
                                                                                      public void setRating(int rating) {
                                                                                          this.rating = rating;
                                                                                      }
                                                                                      public String getGenre() {
                                                                                          return genre;
                                                                                      }
                                                                                      public void setGenre(String genre) {
                                                                                          this.genre = genre;
                                                                                      }
                                                                                      @Override
                                                                                      public String toString() {
                                                                                          return "Movie [mNo=" + mNo + ", mName=" + mName + ", rating=" + rating + ", genre=" + genre + "]";
                                                                                      }
                                                                                          
                                                                                  }
                                                                                  

                                                                                  Interface:

                                                                                  package com.it.skill.repo;
                                                                                  
                                                                                  import org.springframework.data.repository.CrudRepository;
                                                                                  import org.springframework.stereotype.Repository;
                                                                                  
                                                                                  import com.it.skill.movies.Movie;
                                                                                  
                                                                                  @Repository 
                                                                                  public interface IMovieRepo extends CrudRepository{
                                                                                  
                                                                                      public Movie addMovie(String movieName,Integer rating,String Genre);
                                                                                      
                                                                                  }
                                                                                  

                                                                                  Service class

                                                                                  package com.it.skill.service;
                                                                                  
                                                                                  import org.springframework.beans.factory.annotation.Autowired;
                                                                                  import org.springframework.stereotype.Service;
                                                                                  
                                                                                  import com.it.skill.movies.Movie;
                                                                                  import com.it.skill.repo.IMovieRepo;
                                                                                  
                                                                                  @Service
                                                                                  public class IMovieService {
                                                                                  
                                                                                      @Autowired
                                                                                      private IMovieRepo movieRepository;
                                                                                  
                                                                                          
                                                                                      public Integer addMovie(Movie movie)
                                                                                      {
                                                                                          //Movie movie = new Movie();
                                                                                          movieRepository.save(movie);
                                                                                          return movie.getRating();
                                                                                          
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  Following is my Movie Controller class

                                                                                  package com.it.skill.controller;
                                                                                  
                                                                                  import org.springframework.beans.factory.annotation.Autowired;
                                                                                  import org.springframework.http.HttpStatus;
                                                                                  import org.springframework.http.ResponseEntity;
                                                                                  import org.springframework.web.bind.annotation.PostMapping;
                                                                                  import org.springframework.web.bind.annotation.RequestBody;
                                                                                  import org.springframework.web.bind.annotation.RestController;
                                                                                  
                                                                                  import com.it.skill.movies.Movie;
                                                                                  import com.it.skill.service.IMovieService;
                                                                                  
                                                                                  @RestController
                                                                                  public class MovieController {
                                                                                  
                                                                                      @Autowired
                                                                                      private IMovieService movieService;
                                                                                      
                                                                                      //add single project
                                                                                      @PostMapping(path = "/movies/add/", consumes = "application/json")
                                                                                      public ResponseEntity addNewMovie(@RequestBody Movie movie) {
                                                                                          Integer iRating =  movieService.addMovie(movie);
                                                                                          if(iRating!=null)
                                                                                          {
                                                                                              return new ResponseEntity("Movie saved with rating: " +iRating, HttpStatus.CREATED);
                                                                                          }
                                                                                          return new ResponseEntity("Movie not saved", HttpStatus.NOT_ACCEPTABLE);
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  Following is my Application.properties file

                                                                                  spring.application.name=Restful-App-Movies
                                                                                  server.servlet.context-path=/Restful-App-Movies
                                                                                  server.port=8082
                                                                                  ## MySQL
                                                                                  spring.datasource.url=jdbc:mysql://localhost:3306/sakila
                                                                                  spring.datasource.username=root
                                                                                  spring.datasource.password=root
                                                                                  

                                                                                  following is my pom.xml

                                                                                  
                                                                                  
                                                                                      4.0.0
                                                                                      
                                                                                          org.springframework.boot
                                                                                          spring-boot-starter-parent
                                                                                          2.4.6
                                                                                           
                                                                                      
                                                                                      com.it.skill
                                                                                      rest-app-1
                                                                                      0.0.1-SNAPSHOT
                                                                                      rest-app-1
                                                                                      Demo project for Spring Boot
                                                                                      
                                                                                          1.8
                                                                                      
                                                                                      
                                                                                          
                                                                                          
                                                                                              org.springframework.boot
                                                                                              spring-boot-starter-data-jpa           
                                                                                          
                                                                                          
                                                                                              mysql
                                                                                              mysql-connector-java
                                                                                          
                                                                                          
                                                                                  
                                                                                          
                                                                                          
                                                                                              com.fasterxml.jackson.dataformat
                                                                                              jackson-dataformat-xml
                                                                                              2.11.3
                                                                                          
                                                                                          
                                                                                          
                                                                                              org.springframework.boot
                                                                                              spring-boot-starter-web
                                                                                          
                                                                                  
                                                                                          
                                                                                              org.springframework.boot
                                                                                              spring-boot-starter-test
                                                                                              test
                                                                                          
                                                                                          
                                                                                          
                                                                                              org.springframework.boot
                                                                                              spring-boot-devtools
                                                                                              
                                                                                          
                                                                                          
                                                                                      
                                                                                  
                                                                                      
                                                                                          
                                                                                              
                                                                                                  org.springframework.boot
                                                                                                  spring-boot-maven-plugin
                                                                                              
                                                                                          
                                                                                      
                                                                                  
                                                                                  
                                                                                  

                                                                                  2021-06-11 12:14:41.308 WARN 4108 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'movieController': Unsatisfied dependency expressed through field 'movieService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'IMovieService': Unsatisfied dependency expressed through field 'movieRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IMovieRepo' defined in com.it.skill.repo.IMovieRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract com.it.skill.movies.Movie com.it.skill.repo.IMovieRepo.addMovie(java.lang.String,java.lang.Integer,java.lang.String)! No property addMovie found for type Movie! 2021-06-11 12:14:41.308 INFO 4108 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2021-06-11 12:14:41.312 INFO 4108 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2021-06-11 12:14:41.322 INFO 4108 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. 2021-06-11 12:14:41.324 INFO 4108 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2021-06-11 12:14:41.337 INFO 4108 --- [ restartedMain] ConditionEvaluationReportLoggingListener :

                                                                                  Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
                                                                                  2021-06-11 12:14:41.362 ERROR 4108 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed
                                                                                  
                                                                                  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'movieController': Unsatisfied dependency expressed through field 'movieService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'IMovieService': Unsatisfied dependency expressed through field 'movieRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IMovieRepo' defined in com.it.skill.repo.IMovieRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract com.it.skill.movies.Movie com.it.skill.repo.IMovieRepo.addMovie(java.lang.String,java.lang.Integer,java.lang.String)! No property addMovie found for type Movie!
                                                                                      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.6.jar:2.4.6]
                                                                                      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.6.jar:2.4.6]
                                                                                      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) ~[spring-boot-2.4.6.jar:2.4.6]
                                                                                      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.4.6.jar:2.4.6]
                                                                                      at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.6.jar:2.4.6]
                                                                                      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.6.jar:2.4.6]
                                                                                      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) ~[spring-boot-2.4.6.jar:2.4.6]
                                                                                      at com.it.skill.MovieApplication.main(MovieApplication.java:13) ~[classes/:na]
                                                                                      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
                                                                                      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[na:na]
                                                                                      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
                                                                                      at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
                                                                                      at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.6.jar:2.4.6]
                                                                                  Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'IMovieService': Unsatisfied dependency expressed through field 'movieRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IMovieRepo' defined in com.it.skill.repo.IMovieRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract com.it.skill.movies.Movie com.it.skill.repo.IMovieRepo.addMovie(java.lang.String,java.lang.Integer,java.lang.String)! No property addMovie found for type Movie!
                                                                                      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      ... 26 common frames omitted
                                                                                  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IMovieRepo' defined in com.it.skill.repo.IMovieRepo defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract com.it.skill.movies.Movie com.it.skill.repo.IMovieRepo.addMovie(java.lang.String,java.lang.Integer,java.lang.String)! No property addMovie found for type Movie!
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      ... 40 common frames omitted
                                                                                  Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract com.it.skill.movies.Movie com.it.skill.repo.IMovieRepo.addMovie(java.lang.String,java.lang.Integer,java.lang.String)! No property addMovie found for type Movie!
                                                                                      at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.(PartTreeJpaQuery.java:96) ~[spring-data-jpa-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:107) ~[spring-data-jpa-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:218) ~[spring-data-jpa-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:81) ~[spring-data-jpa-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:100) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(QueryExecutorMethodInterceptor.java:93) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
                                                                                      at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) ~[na:na]
                                                                                      at java.base/java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1056) ~[na:na]
                                                                                      at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
                                                                                      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
                                                                                      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
                                                                                      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.mapMethodsToQuery(QueryExecutorMethodInterceptor.java:95) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$new$0(QueryExecutorMethodInterceptor.java:85) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at java.base/java.util.Optional.map(Optional.java:258) ~[na:na]
                                                                                      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.(QueryExecutorMethodInterceptor.java:85) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:303) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:323) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.util.Lazy.getNullable(Lazy.java:230) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.util.Lazy.get(Lazy.java:114) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:329) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:144) ~[spring-data-jpa-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[spring-beans-5.3.7.jar:5.3.7]
                                                                                      ... 50 common frames omitted
                                                                                  Caused by: org.springframework.data.mapping.PropertyReferenceException: No property addMovie found for type Movie!
                                                                                      at org.springframework.data.mapping.PropertyPath.(PropertyPath.java:90) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:437) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:413) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:366) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330) ~[na:na]
                                                                                      at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:348) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:331) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.query.parser.Part.(Part.java:81) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:249) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
                                                                                      at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[na:na]
                                                                                      at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
                                                                                      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
                                                                                      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
                                                                                      at org.springframework.data.repository.query.parser.PartTree$OrPart.(PartTree.java:250) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:383) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[na:na]
                                                                                      at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[na:na]
                                                                                      at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
                                                                                      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
                                                                                      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
                                                                                      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[na:na]
                                                                                      at org.springframework.data.repository.query.parser.PartTree$Predicate.(PartTree.java:384) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.repository.query.parser.PartTree.(PartTree.java:92) ~[spring-data-commons-2.4.9.jar:2.4.9]
                                                                                      at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.(PartTreeJpaQuery.java:89) ~[spring-data-jpa-2.4.9.jar:2.4.9]
                                                                                      ... 76 common frames omitted
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2021-Jun-11 at 07:41

                                                                                  Remove the below method within the repository interface. The JPA has only find…By, read…By, get…By, query…By, search…By, stream…By.. and so on.

                                                                                  public Movie addMovie(String movieName,Integer rating,String Genre);
                                                                                  

                                                                                  there is a default method as repository.save() for inserting objects into the database.

                                                                                  See More at https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repository-query-keywords

                                                                                  Source https://stackoverflow.com/questions/67932668

                                                                                  Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                                                                                  Vulnerabilities

                                                                                  No vulnerabilities reported

                                                                                  Install httpstatus

                                                                                  You can download it from GitHub.

                                                                                  Support

                                                                                  For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
                                                                                  Find more information at:
                                                                                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                  Find more libraries
                                                                                  Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                  Save this library and start creating your kit
                                                                                  CLONE
                                                                                • HTTPS

                                                                                  https://github.com/Readify/httpstatus.git

                                                                                • CLI

                                                                                  gh repo clone Readify/httpstatus

                                                                                • sshUrl

                                                                                  git@github.com:Readify/httpstatus.git

                                                                                • Share this Page

                                                                                  share link

                                                                                  Explore Related Topics

                                                                                  Consider Popular HTTP Libraries

                                                                                  requests

                                                                                  by psf

                                                                                  okhttp

                                                                                  by square

                                                                                  Alamofire

                                                                                  by Alamofire

                                                                                  wrk

                                                                                  by wg

                                                                                  mitmproxy

                                                                                  by mitmproxy

                                                                                  Try Top Libraries by Readify

                                                                                  GitViz

                                                                                  by ReadifyC#

                                                                                  TeamFlash

                                                                                  by ReadifyC#

                                                                                  telstra-purple-signatures

                                                                                  by ReadifyJavaScript

                                                                                  Owin.ForceHttps

                                                                                  by ReadifyC#

                                                                                  IocDevDay

                                                                                  by ReadifyJavaScript

                                                                                  Compare HTTP Libraries with Highest Support

                                                                                  mitmproxy

                                                                                  by mitmproxy

                                                                                  feign

                                                                                  by OpenFeign

                                                                                  resilience4j

                                                                                  by resilience4j

                                                                                  okhttp

                                                                                  by square

                                                                                  actix-web

                                                                                  by actix

                                                                                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                  Find more libraries
                                                                                  Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                  Save this library and start creating your kit