小编Dam*_*ana的帖子

示例项目无法启动

配置文件

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.example.demo.resolver.Mutation;
import com.example.demo.resolver.Query;

import graphql.GraphQL;
import graphql.schema.GraphQLSchema;
import static com.coxautodev.graphql.tools.SchemaParser.newParser;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Autowired
    private static Query query;

    @Autowired
    private static Mutation mutation;

    @Bean
    public BCryptPasswordEncoder passwordEncoder() {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        return bCryptPasswordEncoder;
    }

    @Autowired
    public GraphQL graphQL() {
        return GraphQL.newGraphQL(graphQLSchema())
                .build();
    }


    public static GraphQLSchema graphQLSchema(){
        return newParser()
                .file("schema.graphqls")
                .resolvers(query,mutation)
                .build()
                .makeExecutableSchema();
    }

}
Run Code Online (Sandbox Code Playgroud)

图式

type User {
  uid: Long!
  name: …
Run Code Online (Sandbox Code Playgroud)

mysql rethinkdb spring-boot graphql-java

2
推荐指数
1
解决办法
2362
查看次数

标签 统计

graphql-java ×1

mysql ×1

rethinkdb ×1

spring-boot ×1