Giter Club home page Giter Club logo

spring-petclinic-graphql's People

Contributors

arey avatar babinslava avatar boly38 avatar bram-atmire avatar cbeams avatar colinbut avatar craigsdennis avatar cyrille-leclerc avatar dependabot[bot] avatar freemansoft avatar gordonad avatar helloworld123122344134 avatar liouxiao avatar lukasz-szewc avatar meltsufin avatar mklose avatar nilshartmann avatar patrickcrocker avatar rstoyanchev avatar srbala avatar srenkens avatar tduchateau avatar tejasm avatar thinkshihang avatar trepel avatar verydapeng avatar vfedoriv avatar vladfau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-petclinic-graphql's Issues

Incompatible with Java 11

./mvnw spring-boot:run run just fine on Java 8 but fails on 11 version with:

$ ./mvnw spring-boot:run
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dsun.java2d.pmoffscreen=false -XX:+UseCompressedOops -XX:+DoEscapeAnalysis -XX:+AggressiveOpts -XX:+EliminateLocks -XX:+UseNUMA -XX:+TieredCompilation
OpenJDK 64-Bit Server VM warning: Option AggressiveOpts was deprecated in version 11.0 and will likely be removed in a future release.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building petclinic 2.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:2.0.1.RELEASE:run (default-cli) > test-compile @ spring-petclinic >>>
[INFO] 
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ spring-petclinic ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 11 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ spring-petclinic ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 83 source files to /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vets.java:[18,33] package javax.xml.bind.annotation does not exist
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vets.java:[19,33] package javax.xml.bind.annotation does not exist
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vets.java:[29,2] cannot find symbol
  symbol: class XmlRootElement
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vet.java:[23,33] package javax.xml.bind.annotation does not exist
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vets.java:[34,6] cannot find symbol
  symbol:   class XmlElement
  location: class org.springframework.samples.petclinic.model.Vets
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vet.java:[55,6] cannot find symbol
  symbol:   class XmlElement
  location: class org.springframework.samples.petclinic.model.Vet
[INFO] 6 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.110 s
[INFO] Finished at: 2019-02-09T23:24:33+03:00
[INFO] Final Memory: 32M/148M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project spring-petclinic: Compilation failure: Compilation failure:
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vets.java:[18,33] package javax.xml.bind.annotation does not exist
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vets.java:[19,33] package javax.xml.bind.annotation does not exist
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vets.java:[29,2] cannot find symbol
[ERROR] symbol: class XmlRootElement
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vet.java:[23,33] package javax.xml.bind.annotation does not exist
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vets.java:[34,6] cannot find symbol
[ERROR] symbol:   class XmlElement
[ERROR] location: class org.springframework.samples.petclinic.model.Vets
[ERROR] /home/pasha/@Projects/@Senso/webapp.spring-petclinic-graphql/backend/src/main/java/org/springframework/samples/petclinic/model/Vet.java:[55,6] cannot find symbol
[ERROR] symbol:   class XmlElement
[ERROR] location: class org.springframework.samples.petclinic.model.Vet
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Login page error

I could not compile and run the front-end application. The LoginPage.tsx would not compile giving
} catch (err) {
console.error("LOGIN FAILED ================ >>>>>>>>>>>>>>>>> ", err);
setLoginRequestState({ error: err.message });
}

at line 54,34

I do get login screen after npm start but application crashed

Failed to run backend as WAR package

I was able to run the backend using Maven: mvnw spring-boot:run. Now I have this requirement to deploy it to Apache TOMCAT server with context path /petclinic.

When I test the connection to graphql using url /petclinic/graphql, it just returns 404 error. I have changed the settings in application.properties as:
graphql.servlet.mapping=/petclinic/graphql

Do I miss out any configuration?

deploy WAR to weblogic

Hi,

I'm trying to deploy this demo app to weblogic 12c but failed to start it:

INFO AutoConfigurationReportLoggingInitializer -

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
ERROR SpringApplication - Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServletRegistrationBean' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServletRegistrationBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLServlet' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLServlet' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchemaProvider' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchemaProvider' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphQLSchema' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLJavaToolsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'graphQLSchema' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaParser' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLJavaToolsAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.coxautodev.graphql.tools.SchemaParser]: Factory method 'schemaParser' threw exception; nested exception is java.lang.IllegalStateException: No *.graphqls files found on classpath. Please add a graphql schema to the classpath or add a SchemaParser bean to your application context.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)

To support weblogic, I also made a few changes:

  1. change the main application as:
    public class PetClinicApplication extends SpringBootServletInitializer implements WebApplicationInitializer {...}

  2. add weblogic.xml to resolve the dependency conflicts:
    <wls:weblogic-web-app
    xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
    http://xmlns.oracle.com/weblogic/weblogic-web-app
    http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">

    wls:container-descriptor
    wls:prefer-web-inf-classestrue</wls:prefer-web-inf-classes>
    </wls:container-descriptor>
    </wls:weblogic-web-app>

but the same WAR file can be deployed to TOMCAT and start it successfully. I also check the source code GraphQLJavaToolsAutoConfiguration.java which loads the files:
Resource[] resources = applicationContext.getResources("classpath*:**/*.graphqls");
if(resources.length <= 0) {
throw new IllegalStateException("No *.graphqls files found on classpath. Please add a graphql schema to the classpath or add a SchemaParser bean to your application context.");
}

Incorrect Package Name

package org.springframework.samples.petclinic.service;
Change this to - package org.springframework.samples.petclinic.repository;

Please add me to this project contributor. I would like to contribute.

Example with "Microservice" and DataLoader

Hi @arey and all!

I created another variation of the spring-petclinic-graphql example, that I needed for trainings and other demonstrations.

This version uses a second backend "micro service" (for managing Vets) that can be used to demonstrate working of DataLoaders when collecting data for a GraphQL response from other remote services.

Everything else is almost the same as in our current example. Do you think I should merge the "new" example to this repository? I think it's a more realistic example with two backend services and it's also important to have a DataLoader example.

You can find my repo here: https://github.com/nilshartmann/spring-petclinic-graphql-microservice

If interessted, I would merge that back into this repo.

Thanks,
Nils

Convert to Kotlin

Another change is from Java, pl. use kotlin again as it is latest.

License

Hi! I'm having trouble finding out what license this code is released under. In one other project in this org I saw that it was Apache 2.0. Does this have that license too? If so, could a license file be added?

Thanks!

spring-graphql example

Hi,

on the branch spring-graphql I started implementing an example based on the recently announced new spring-graphql project.

I wonder if we:

  1. should replace the existing example (that uses the outdated graphql-java-tools lib, that is now graphql-java-kickstart with the spring-graphql-based one (merge spring-graphql-branch to master)
  2. or if we should create a new GitHub repo with the new example spring-graphql-example.

Myself, I'm unsure, but tend to option 1, as the current example is outdated anyway (and we can create an own branch for that example to make it still accessible for everyone) and spring-graphql might become the "offcial" GraphQL solution for spring anyway in the near future.

What do you think?

Best,
Nils

npm install -> errors

xxx@pop-os:~/projects/tests/spring-petclinic-graphql/frontend$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/typescript
npm ERR! typescript@"^4.1.3" from the root project
npm ERR! peer typescript@">=2.7" from [email protected]
npm ERR! node_modules/ts-node
npm ERR! ts-node@"^9" from @endemolshinegroup/[email protected]
npm ERR! node_modules/@endemolshinegroup/cosmiconfig-typescript-loader
npm ERR! @endemolshinegroup/cosmiconfig-typescript-loader@"3.0.2" from [email protected]
npm ERR! node_modules/graphql-config
npm ERR! graphql-config@"^3.2.0" from @graphql-codegen/[email protected]
npm ERR! node_modules/@graphql-codegen/cli
npm ERR! peerOptional ts-node@">=9.0.0" from [email protected]
npm ERR! node_modules/jest-config
npm ERR! jest-config@"^26.6.3" from @jest/[email protected]
npm ERR! node_modules/@jest/core
npm ERR! @jest/core@"^26.6.0" from [email protected]
npm ERR! node_modules/jest
npm ERR! 1 more (jest-cli)
npm ERR! 3 more (jest-runner, jest-runtime, jest-cli)
npm ERR! 1 more (tsutils)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1" from [email protected]
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"4.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/typescript
npm ERR! peerOptional typescript@"^3.2.1" from [email protected]
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@"4.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/xxxj/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/xxx/.npm/_logs/2022-06-18T20_13_33_959Z-debug-0.log

Drop frontend for spring-graphql version?

Hi,

I'm going to upgrade the spring-graphql branch to latest spring boot and spring-graphql versions soon (waiting for SB 2.7.0 M3 to be released).

And now I'm wondering, if we should remove the react frontend from the example at all and only provide the backend (like spring-petclinic-rest is doing).

Reasons:

  1. If one wants to have an example for spring-graphql the backend is enough, we can enable graphiql, so anyone can try the graphql API without a "real" frontend.
  2. We can focus on the backend, add more examples, maybe even some more "real-world" usecases (for example perforamnce optimization, integrating other APIs etc)
  3. The current frontend is React and Apollo specific. While this is not an uncommon setup imho (Java/Spring + React + Apollo) it's not a setup everyone uses. Others are using Angular or Vue or using other GraphQL client frameworks than Apollo... So the frontend only helps some people and also it doesn't help understanding spring-graphql at all (I think).

As an alternative we could provide frontends in own projects, as the spring-petclinic-angular project is doing for the spring-petclinic-rest backend.

I really enjoyed building the React frontend and still think it's a good demonstration of a powerful tech stack, I think it's too much for this spring-petclinic-graphql example ๐Ÿ˜ข

What do you think?

Running backend locally fails

Dear Nils,
when I'm trying to run the backend project locally as described i get an error.

The project builds correctly but when it's supposed to start i get:

`2023-12-05T23:46:30.925+01:00 ERROR 26962 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed

org.springframework.boot.docker.compose.core.ProcessExitException: 'docker-compose version --format json' failed with exit code 1.

Stdout:

Stderr:
Show version information

Usage: version [--short]

Options:
--short Shows only Compose's version number.

at org.springframework.boot.docker.compose.core.ProcessRunner.run(ProcessRunner.java:96) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.core.ProcessRunner.run(ProcessRunner.java:74) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.getDockerComposeCommand(DockerCli.java:165) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.<init>(DockerCli.java:130) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.core.DockerCli.lambda$new$0(DockerCli.java:65) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220) ~[na:na]
at org.springframework.boot.docker.compose.core.DockerCli.<init>(DockerCli.java:64) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.core.DockerCompose.get(DockerCompose.java:92) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.getDockerCompose(DockerComposeLifecycleManager.java:149) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:110) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.2.0.jar:3.2.0]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-6.1.1.jar:6.1.1]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171) ~[spring-context-6.1.1.jar:6.1.1]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:149) ~[spring-context-6.1.1.jar:6.1.1]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:137) ~[spring-context-6.1.1.jar:6.1.1]
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.2.0.jar:3.2.0]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:431) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:322) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar:3.2.0]
at org.springframework.samples.petclinic.PetClinicApplication.main(PetClinicApplication.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:77) ~[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:568) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.2.0.jar:3.2.0]

`

Do you have any idea what is causing it?
I'm running linux and docker-composer is installed.

Kim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.