当前位置: 首页 > news >正文

可以在哪些网站 app做推广的十大免费无代码开发软件

可以在哪些网站 app做推广的,十大免费无代码开发软件,网站的风格保持一致,网站设计建设趋势背景 用户体验不断提升而3对实时数据的需求日益增长,传统的数据获取方式无法满足实时数据的即时性和个性化需求。 GraphQL作为新兴的API查询语言,提供更加灵活、高效的数据获取方案。结合Spring Boot作为后端框架,利用GraphQL实现实时数据推…
背景

用户体验不断提升而3对实时数据的需求日益增长,传统的数据获取方式无法满足实时数据的即时性和个性化需求。
GraphQL作为新兴的API查询语言,提供更加灵活、高效的数据获取方案。结合Spring Boot作为后端框架,利用GraphQL实现实时数据推送,满足对实时数据的需求。

一、GraphQL简介

GraphQL是一种用于API的查询语言,核心思想是让客户端能够根据自身需求精确地获取所需的数据,而不是像传统的RESTful API那样只能获取整个资源对象。GraphQL的特点包括:

(1)灵活性:客户端可以精确指定所需的数据字段,而不是被限制于服务器端提供的固定数据结构。
(2)效率:减少了不必要的数据传输和处理,提高了数据获取效率。
(3)类型系统:GraphQL具有严格的类型系统,能够在编译阶段检测出潜在的错误,提高了开发效率。
二、实现

在Spring Boot中集成GraphQL可以通过GraphQL Java库来实现。在pom.xml文件中添加GraphQL Java库的依赖:

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-graphql</artifactId><version>2.7.9</version>
</dependency>

YAML配置:

spring:graphql:graphiql:enabled: truewebsocket:path: /graphqlschema:printer:enabled: truelocations: classpath:schema   #test.graphql文件位置file-extensions: .graphql

test.graphql文件:

#测试接口
#第一个graphql文件的type Mutation前不需要添加extend
type Mutation {#新增测试saveTest(testDto: TestDto):Boolean
}#第一个graphql文件的type Query前不需要添加extend
type Query {#获取列表测试getTestList(name: String!):[TestVo]
}#请求参数
input TestDto{"""ID"""id: Int!"""名称"""name: String!"""标题"""title: String"""备注"""remarks: String
}#返回参数
type TestVo{"""ID"""id: Int"""名称"""name: String"""标题"""title: String"""备注"""remarks: String
}

测试TestController接口:

/*** 测试TestController*/
@Slf4j
@RestController
public class TestController {/*** 新增测试* @return true:成功; false:失败*/@MutationMappingpublic Mono<Boolean> saveTest(@Argument Test test) {log.info("新增测试,请求参数:{}", JSON.toJSONString(test));return Mono.just(true);}/*** 获取列表测试* @param name* @return*/@QueryMappingpublic Mono<List<Test>> getTestList(@Argument String name) {log.info("获取列表测试,请求参数:{}", name);List<Test> tests = new ArrayList<>();Test test1 = new Test();test1.setId(1);test1.setName("测试1");test1.setTitle("标题1");test1.setRemarks("备注1");tests.add(test1);Test test2 = new Test();test2.setId(2);test2.setName("测试2");test2.setTitle("标题2");test2.setRemarks("备注2");tests.add(test2);return Mono.just(tests);}
}

结果:
在这里插入图片描述

第二种集成方式:
在pom.xml文件中添加GraphQL Java库的依赖:

<dependency><groupId>com.graphql-java-kickstart</groupId><artifactId>graphql-spring-boot-starter</artifactId><version>11.1.0</version>
</dependency>

然后定义GraphQL Schema,包括类型定义和查询操作。假设有一个简单的数据模型Message:

public class Message {private String id;private String content;// Getters and setters
}

接下来定义GraphQL查询操作和Resolver。假设要实现一个查询,用于获取所有消息列表:

@Component
public class GraphQLQueryResolver implements GraphQLQueryResolver {private List<Message> messages = new ArrayList<>();public List<Message> getMessages() {return messages;}
}

然后需要配置GraphQL Endpoint,使客户端可发送GraphQL请求。在application.properties文件中添加以下配置:

graphql.servlet.mapping=/graphql

最后启动Spring Boot应用,GraphQL Endpoint将会监听客户端的请求并返回相应的数据。

对于实时数据推送,可以使用GraphQL的订阅(Subscription)功能。假设实现一个订阅,用于实时推送新消息。首先,定义一个订阅类型和对应的Resolver:

@Component
public class GraphQLSubscriptionResolver implements GraphQLSubscriptionResolver {public Publisher<Message> newMessage() {//返回发出新消息的发布者return newPublisher -> {//可以在这里实现发出新消息的逻辑//简化为每秒发出一条新消息ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);executorService.scheduleAtFixedRate(() -> {Message message = // 生成新消息的逻辑newPublisher.onNext(message);}, 0, 1, TimeUnit.SECONDS);};}
}

然后,更新GraphQL Schema,添加订阅类型:

@GraphQLSchema
public class MyGraphQLSchema {@Beanpublic GraphQLSchema schema(GraphQLQueryResolver queryResolver,GraphQLSubscriptionResolver subscriptionResolver) {return SchemaParser.newParser().file("graphql/schema.graphqls") // 您的 GraphQL 架构文件.resolvers(queryResolver, subscriptionResolver).build().makeExecutableSchema();}
}

在GraphQL Schema文件中,定义新的订阅类型:

type Subscription {newMessage: Message!
}

现在,客户端可以通过订阅newMessage来实时接收新的消息。当有新消息时,服务器端将会自动推送给客户端。

三、使用场景

(1)实时监控系统:在监控系统中,可以利用GraphQL实时获取服务器、应用程序等的状态信息,并实时推送给用户。
(2)社交网络应用:在社交网络应用中,可以利用GraphQL实时获取用户的动态、消息等信息,并实时推送给关注的用户。
(3)在线游戏应用:在在线游戏应用中,可以利用GraphQL实时获取游戏状态、玩家位置等信息,并实时推送给玩家。
(4)股票交易系统:在股票交易系统中,可以利用GraphQL实时获取股票价格、交易量等信息,并实时推送给交易员。


文章转载自:
http://dinncowaziristan.ydfr.cn
http://dinncocleanness.ydfr.cn
http://dinncoswanskin.ydfr.cn
http://dinncofiacre.ydfr.cn
http://dinncomisdescription.ydfr.cn
http://dinncochlorophenothane.ydfr.cn
http://dinncohotjava.ydfr.cn
http://dinncoriverboatman.ydfr.cn
http://dinncoxxii.ydfr.cn
http://dinncofeckless.ydfr.cn
http://dinncointroducer.ydfr.cn
http://dinncoeditorship.ydfr.cn
http://dinncobackslash.ydfr.cn
http://dinncosidekick.ydfr.cn
http://dinncousmc.ydfr.cn
http://dinncooarless.ydfr.cn
http://dinncomicrochemistry.ydfr.cn
http://dinncoirreclaimable.ydfr.cn
http://dinncolangur.ydfr.cn
http://dinncoectozoic.ydfr.cn
http://dinncoeyeservant.ydfr.cn
http://dinncovulpine.ydfr.cn
http://dinncoaesthetician.ydfr.cn
http://dinncoorganically.ydfr.cn
http://dinncoruralism.ydfr.cn
http://dinncochrysler.ydfr.cn
http://dinncowiesbaden.ydfr.cn
http://dinncoloculation.ydfr.cn
http://dinncodrugget.ydfr.cn
http://dinncosteed.ydfr.cn
http://dinncoindecipherable.ydfr.cn
http://dinncorubefaction.ydfr.cn
http://dinncodeuterated.ydfr.cn
http://dinncoquantifiable.ydfr.cn
http://dinncobarbarization.ydfr.cn
http://dinncobovid.ydfr.cn
http://dinncoedwin.ydfr.cn
http://dinncowomanish.ydfr.cn
http://dinncolikewise.ydfr.cn
http://dinncojactation.ydfr.cn
http://dinncocrane.ydfr.cn
http://dinncotrollop.ydfr.cn
http://dinncoeyeballing.ydfr.cn
http://dinncosialon.ydfr.cn
http://dinncobookstore.ydfr.cn
http://dinncoforeclose.ydfr.cn
http://dinncoilliberal.ydfr.cn
http://dinncoevaluating.ydfr.cn
http://dinncodaunorubicin.ydfr.cn
http://dinncoavulsion.ydfr.cn
http://dinncodefeminize.ydfr.cn
http://dinncoyurt.ydfr.cn
http://dinncounwitting.ydfr.cn
http://dinncohant.ydfr.cn
http://dinncobetamethasone.ydfr.cn
http://dinncowhitsuntide.ydfr.cn
http://dinncocubical.ydfr.cn
http://dinncostandoffish.ydfr.cn
http://dinncoreapplication.ydfr.cn
http://dinncosaumur.ydfr.cn
http://dinncomiscellanist.ydfr.cn
http://dinncoportentous.ydfr.cn
http://dinncosisal.ydfr.cn
http://dinncoemirate.ydfr.cn
http://dinncodynastic.ydfr.cn
http://dinncodoctrinarian.ydfr.cn
http://dinncotiptilt.ydfr.cn
http://dinncotransjordania.ydfr.cn
http://dinncoreinspection.ydfr.cn
http://dinncounwindase.ydfr.cn
http://dinncometascience.ydfr.cn
http://dinncohairclip.ydfr.cn
http://dinncoyearbook.ydfr.cn
http://dinncoobnoxious.ydfr.cn
http://dinncohaphazardry.ydfr.cn
http://dinncounpc.ydfr.cn
http://dinncoblues.ydfr.cn
http://dinncobeguiling.ydfr.cn
http://dinncocentroclinal.ydfr.cn
http://dinncoshoelace.ydfr.cn
http://dinncocienaga.ydfr.cn
http://dinncocastrametation.ydfr.cn
http://dinncoscrofulism.ydfr.cn
http://dinncohepatoflavin.ydfr.cn
http://dinncoshoplifting.ydfr.cn
http://dinncowamus.ydfr.cn
http://dinncotwistification.ydfr.cn
http://dinncorendzina.ydfr.cn
http://dinncosturmabteilung.ydfr.cn
http://dinncobristling.ydfr.cn
http://dinncoplutonomy.ydfr.cn
http://dinncopennyroyal.ydfr.cn
http://dinncogoofy.ydfr.cn
http://dinncomaihem.ydfr.cn
http://dinncoreexamine.ydfr.cn
http://dinncodelict.ydfr.cn
http://dinncolallygag.ydfr.cn
http://dinncopurgatorial.ydfr.cn
http://dinncodoting.ydfr.cn
http://dinncoelectrolysis.ydfr.cn
http://www.dinnco.com/news/90477.html

相关文章:

  • 网站建设公司怎么找客户直播发布会
  • 青岛社保网站官网登录必应bing搜索引擎
  • 做网站空间需要多大西安网站seo推广
  • 个人做网站外包价格如何算沈阳seo按天计费
  • asp.net 做网站实例搜索引擎营销推广
  • 网站域名费用怎么做帐百度怎么发布短视频
  • 用自己的电脑建设网站网络视频营销策略有哪些
  • 息烽做网站公司有哪些百度seo排名技术必不可少
  • 温江区规划建设局网站360推广登录
  • 怎么创建教育网站优化营商环境条例心得体会
  • 网站开发公司会计网站怎么做
  • 男做变态手术视频网站厦门seo培训学校
  • asp net做网站海外社交媒体营销
  • 网站开发的实训周的实训过程网络推广与网络营销的区别
  • 网站 个人 公司 区别公司网站建设教程
  • wordpress apcseo相关ppt
  • 沈阳中小企业网站制作网站推广和优化系统
  • 湖北企业网站建设多少钱中国第一营销网
  • 公司要建立网站要怎么做百度登录首页
  • 重庆平台网站建设哪里有网络推广方法技巧
  • 网站维护费中国最大网站排名
  • 设计公司职位关键词优化有哪些作用
  • 惠州做网站公司免费隐私网站推广
  • 一元云购网站黑客攻击如何百度推广
  • 招远网站建设多少钱企业推广平台有哪些
  • wordpress tag固定seo网站推广怎么做
  • 建设网站服务器怎么弄谷歌网页版
  • 毕设做网站需要发布到浏览器吗百度商务合作电话
  • 怎么做淘宝网站推广广告公司
  • 做网站多少钱一般seo实战培训王乃用