一个很有趣的示例Spring Boot项目,使用Giraphe CMS和Spring Boot

6: 这是一个很有趣的示例Spring Boot项目,使用Giraphe CMS和Spring Boot。 Giraphe是基于Spring Boot的CMS框架。

https://github.com/creactiviti/graffiti

https://mp.weixin.qq.com/s/pdSWAhrwypgGWHwBLOxI0Q


Headless Java CMS Framework  https://github.com/creactiviti/giraphe

Headless Java CMS https://github.com/creactiviti/graffiti#how-do-i-use-it-for-my-own-project

 

GraphQL

Working Draft – October 2016

Introduction

This is a Draft RFC Specification for GraphQL, a query language created by Facebook in 2012 for describing the capabilities and requirements of data models for client‐server applications. The development of this standard started in 2015. GraphQL is a new and evolving language and is not complete. Significant enhancement will continue in future editions of this specification.
http://facebook.github.io/graphql/October2016/

GraphQL 是一个由Facebook提出的 应用层查询语言. 使用 GraphQL, 你可以基于图模式定义你的后端. 然后客户端就可以请求所需要的数据集。

作者:尤雨溪
链接:https://www.zhihu.com/question/38596306/answer/79714979
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

GraphQL 确实并没有『火起来』,我觉得是这么几个因素:
1. 要在前端爽爽地使用 GraphQL,必须要在服务端搭建符合 GraphQL spec 的接口,基本上是整个改写服务端暴露数据的方式。目前 FB 官方就只有一个 Node.js 的 reference implementation,其他语言都是社区爱好者自己搞的。另外,GraphQL 在前端如何与视图层、状态管理方案结合,目前也只有 React/Relay 这个一个官方方案。换句话说,如果你不是已经在用 Node + React 这个技术栈,引入 GraphQL 成本略高,风险也不小,这就很大程度上限制了受众。
2. GraphQL 的 field resolve 如果按照 naive 的方式来写,每一个 field 都对数据库直接跑一个 query,会产生大量冗余 query,虽然网络层面的请求数被优化了,但数据库查询可能会成为性能瓶颈,这里面有很大的优化空间,但并不是那么容易做。FB 本身没有这个问题,因为他们内部数据库这一层也是抽象掉的,写 GraphQL 接口的人不需要顾虑 query 优化的问题。
3. 这个事情到底由谁来做?GraphQL 的利好主要是在于前端的开发效率,但落地却需要服务端的全力配合。如果是小公司或者整个公司都是全栈,那可能可以做,但在很多前后端分工比较明确的团队里,要推动 GraphQL 还是会遇到各种协作上的阻力。这可能是没火起来的根本原因。

 

 

package org.springframework.context.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Indicates whether a bean is to be lazily initialized.
 *
 * <p>May be used on any class directly or indirectly annotated with {@link
 * org.springframework.stereotype.Component @Component} or on methods annotated with
 * {@link Bean @Bean}.
 *
 * <p>If this annotation is not present on a {@code @Component} or {@code @Bean} definition,
 * eager initialization will occur. If present and set to {@code true}, the {@code @Bean} or
 * {@code @Component} will not be initialized until referenced by another bean or explicitly
 * retrieved from the enclosing {@link org.springframework.beans.factory.BeanFactory
 * BeanFactory}. If present and set to {@code false}, the bean will be instantiated on
 * startup by bean factories that perform eager initialization of singletons.
 *
 * <p>If Lazy is present on a {@link Configuration @Configuration} class, this
 * indicates that all {@code @Bean} methods within that {@code @Configuration}
 * should be lazily initialized. If {@code @Lazy} is present and false on a {@code @Bean}
 * method within a {@code @Lazy}-annotated {@code @Configuration} class, this indicates
 * overriding the 'default lazy' behavior and that the bean should be eagerly initialized.
 *
 * <p>In addition to its role for component initialization, this annotation may also be placed
 * on injection points marked with {@link org.springframework.beans.factory.annotation.Autowired}
 * or {@link javax.inject.Inject}: In that context, it leads to the creation of a
 * lazy-resolution proxy for all affected dependencies, as an alternative to using
 * {@link org.springframework.beans.factory.ObjectFactory} or {@link javax.inject.Provider}.
 *
 * @author Chris Beams
 * @author Juergen Hoeller
 * @since 3.0
 * @see Primary
 * @see Bean
 * @see Configuration
 * @see org.springframework.stereotype.Component
 */
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Lazy {

    /**
     * Whether lazy initialization should occur.
     */
    boolean value() default true;

}

 

Spring Boot一个基于Java的开发框架,用于快速创建、配置和运行独立的、基于生产环境的应用程序。它提供了一种简单和便捷的方式来构建可扩展、可靠和高效的应用程序。在Spring Boot框架中,我们可以使用CMS(内容管理系统)来管理网站的内容。 Layui是一个流行的前端框架,它提供了一系列简洁、易用而又美观的界面组件,包括表单、表格、弹出层等。我们可以利用Layui框架的各种组件来构建用户友好的界面,给用户提供良好的交互体验。 结合Spring Boot和Layui,我们可以开发一个功能强大、易于管理的CMS系统。基于Spring Boot的特性,我们可以很容易地搭建一个稳定、高效的后端系统,实现数据的增删改查和用户管理等功能。同时,利用Layui的界面组件,我们可以为用户提供直观、美观的操作界面,使他们能够轻松管理网站的内容。 在这个基于Spring Boot和Layui的CMS系统中,我们可以实现以下功能: 1. 文章管理:用户可以创建、编辑和删除文章,包括标题、内容、标签等信息。这些文章可以被分类、标记,便于用户进行检索和管理。 2. 用户管理:系统管理员可以管理用户账户,包括新增、修改和删除用户信息。不同的用户角色可以有不同的权限,确保系统的安全性。 3. 页面管理:用户可以创建和管理网站的页面,包括导航栏、侧边栏等页面元素。页面可以通过拖拽、布局等方式进行设计和定制。 4. 图片管理:用户可以上传、存储和管理网站所需的图片资源。图片可以被应用于文章、页面和其他网站元素。 5. 配置管理:用户可以配置网站的基本信息,如网站名称、LOGO、公司信息等,以及系统的参数和模板等。 总之,使用Spring Boot和Layui可以快速搭建一个功能强大、易于管理的CMS系统,帮助网站管理员轻松管理网站的内容,提升用户体验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值