Crnk

A description of what my library does.

Лицензия

Лицензия

Категории

Категории

Crnk Межпрограммное взаимодействие REST Frameworks
Группа

Группа

io.crnk
Идентификатор

Идентификатор

crnk-setup-servlet
Последняя версия

Последняя версия

3.4.20210509072026
Дата

Дата

Тип

Тип

jar
Описание

Описание

Crnk
A description of what my library does.
Система контроля версий

Система контроля версий

https://github.com/crnk-project/crnk-framework

Скачать crnk-setup-servlet

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.crnk/crnk-setup-servlet/ -->
<dependency>
    <groupId>io.crnk</groupId>
    <artifactId>crnk-setup-servlet</artifactId>
    <version>3.4.20210509072026</version>
</dependency>
// https://jarcasting.com/artifacts/io.crnk/crnk-setup-servlet/
implementation 'io.crnk:crnk-setup-servlet:3.4.20210509072026'
// https://jarcasting.com/artifacts/io.crnk/crnk-setup-servlet/
implementation ("io.crnk:crnk-setup-servlet:3.4.20210509072026")
'io.crnk:crnk-setup-servlet:jar:3.4.20210509072026'
<dependency org="io.crnk" name="crnk-setup-servlet" rev="3.4.20210509072026">
  <artifact name="crnk-setup-servlet" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.crnk', module='crnk-setup-servlet', version='3.4.20210509072026')
)
libraryDependencies += "io.crnk" % "crnk-setup-servlet" % "3.4.20210509072026"
[io.crnk/crnk-setup-servlet "3.4.20210509072026"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
javax.annotation : javax.annotation-api jar 1.2
javax.xml.bind : jaxb-api jar 2.4.0-b180830.0359
io.crnk : crnk-core jar 3.4.20210509072026

Модули Проекта

Данный проект не имеет модулей.

crnk.io - Crank up the development of RESTful applications!

Build Status Gitter License Coverage Status

Bintray release on jcenter
Bintray latest in private repository

What is Crnk?

Crnk is an implementation of the JSON API specification and recommendations in Java to facilitate building RESTful applications. It provides many conventions and building blocks that application can benefit from. This includes features such as sorting, filtering, pagination, requesting complex object graphs, sparse field sets, attaching links to data or atomically execute multiple operations. Further integration with frameworks and libraries such as Spring, CDI, JPA, Bean Validation, Dropwizard, Servlet API, Zipkin and and more ensure that JSON API plays well together with the Java ecosystem. Have a look at www.crnk.io and the documentation for more detailed information.

Release notes can be found in http://www.crnk.io/releases/.

Repository

Crnk Maven artifacts are available from jcenter/bintray: https://bintray.com/crnk-project.

Note that due to reliability issues of MavenCentral we only rarely publish there.

Requirements

Crnk requires Java 1.8 or later and an SLF4J setup for logging.

Example

See https://github.com/crnk-project/crnk-example/

Gradle settings.gradle can look like:

gradle.beforeProject { Project project ->
    project.with {
        buildscript {
            repositories {
                jcenter()
                // maven { url 'https://dl.bintray.com/crnk-project/mavenLatest/' }
            }
        }
        repositories {
            jcenter()
            // maven { url 'https://dl.bintray.com/crnk-project/mavenLatest/' }
        }
    }
}

and the build.gradle:

dependencies {
    implementation platform('io.crnk:crnk-bom:INSERT_VERSION_HERE')
    annotationProcessor platform('io.crnk:crnk-bom:INSERT_VERSION_HERE')

    annotationProcessor 'io.crnk:crnk-gen-java'

    implementation "io.crnk:crnk-setup-spring-boot2"
    implementation "io.crnk:crnk-data-jpa"
    implementation "io.crnk:crnk-data-facet"
    implementation "io.crnk:crnk-format-plain-json"
    implementation "io.crnk:crnk-validation"
    implementation "io.crnk:crnk-home"
    implementation "io.crnk:crnk-ui"
    implementation "io.crnk:crnk-operations"
    implementation "io.crnk:crnk-security"
}

and a basic Java example:

@JsonApiResource(type = "vote")
@Data
public class Vote {

    @JsonApiId
    private UUID id;

    private int stars;

}

public class VoteRepository extends ResourceRepositoryBase<Vote, UUID> {

    public Map<UUID, Vote> votes = new ConcurrentHashMap<>();

    public VoteRepository() {
        super(Vote.class);
    }

    @Override
    public ResourceList<Vote> findAll(QuerySpec querySpec) {
        return querySpec.apply(votes.values());
    }

    @Override
    public <S extends Vote> S save(S entity) {
        votes.put(entity.getId(), entity);
        return null;
    }

    @Override
    public void delete(UUID id) {
        votes.remove(id);
    }
}

or with JPA:

@JsonApiResource(type = "person")
@Entity
@Data
public class PersonEntity {

	@Id
	private UUID id;

	private String name;

	private int year;

	@OneToMany(mappedBy = "movie")
	private List<RoleEntity> roles = new ArrayList<>();

	@Version
	private Integer version;
}

public class PersonRepository extends JpaEntityRepositoryBase<PersonEntity, UUID> {

	public PersonRepository() {
		super(PersonEntity.class);
	}

	@Override
	public PersonEntity save(PersonEntity entity) {
		// add your save logic here
		return super.save(entity);
	}

	@Override
	public PersonEntity create(PersonEntity entity) {
		// add your create logic here
		return super.create(entity);
	}

	@Override
	public void delete(UUID id) {
		// add your save logic here
		super.delete(id);
	}
}

Crnk integrates well with many frameworks. Have a look at the documentation and carefully choose what you need. Don't hesitate to ask for help and suggest improvements!

Licensing

Crnk is licensed under the Apache License, Version 2.0. You can grab a copy of the license at http://www.apache.org/licenses/LICENSE-2.0.

Building from Source

Crnk make use of Gradle for its build. To build the complete project run

gradlew clean build

Note as part of the build a local Node installation is downloaded to build the frontend parts (crnk-ui) of the project.

Links

Endorsements

YourKit

We thank YourKit for supporting open source projects with profiler and monitoring tooling.

Версии библиотеки

Версия
3.4.20210509072026
3.4.20210508153845
2.6.20180522184741
2.6.20180430102904