Giter Club home page Giter Club logo

zhengframework's Introduction

zheng framework

please go to documentation website zhengframework

Java CI with Maven

Zheng framework is a modular framework with many ready-made modules.

Zheng framework uses Google guice for dependency management. For ease of use, most modules support automatic loading through ServiceLoader.

Quick Start

step 1: add maven dependency

<dependencyManagement>
    <dependencies>
      <dependency>
        <artifactId>zheng-bom</artifactId>
        <groupId>com.github.zhengframework</groupId>
        <scope>import</scope>
        <type>pom</type>
        <version>${zheng.version}</version>
      </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
      <artifactId>zheng-bootstrap</artifactId>
      <groupId>com.github.zhengframework</groupId>
    </dependency>
    <dependency>
      <artifactId>zheng-web-jetty</artifactId>
      <groupId>com.github.zhengframework</groupId>
    </dependency>
    <dependency>
      <artifactId>zheng-rest</artifactId>
      <groupId>com.github.zhengframework</groupId>
    </dependency>
</dependencies>

step 2: add config

create config file in resource dir:

src/test/resources/application.properties

content:

zheng.web.contextPath=/
zheng.web.port=8080
zheng.rest.path=/

step 3: create rest resource

create a class to show inject object.

public class Man {

  public String say() {
    return "hello, thanks to use zheng framework";
  }
}
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;

@Path("first")
public class FirstResource {
  private final Man man;

  @Inject
  public FirstResource(Man man) {
    this.man = man;
  }
  
  @GET
  @Path("hello")
  public String hello() {
    return man.say();
  }
}

step 4: create guice module

import com.google.inject.servlet.ServletModule;

public class FirstModule extends ServletModule {

  @Override
  protected void configureServlets() {
    bind(FirstResource.class);
  }
}

step 5: create bootstrap class

import com.github.zhengframework.bootstrap.ZhengApplication;
import com.github.zhengframework.bootstrap.ZhengApplicationBuilder;

public class FirstUseZhengFramework {

  public static void main(String[] args) throws Exception {
    ZhengApplication application = ZhengApplicationBuilder.create()
        .addModule(new FirstModule())
        .build();
    application.start();
  }
}

step 6: run code

  1. please run FirstUseZhengFramework.main
  2. open your web browser, enter url: http://127.0.0.1:8080/first/hello
  3. you will get string: hello, thanks to use zheng framework

Module Info

Module status auto load
zheng-configuration OK yes
zheng-web-jetty OK yes
zheng-web-undertow OK yes
zheng-webjars OK yes
zheng-swagger OK yes
zheng-rabbitmq OK yes
zheng-healthcheck OK yes
zheng-cache OK yes
zheng-mongodb OK yes
zheng-memcached OK yes
zheng-redis OK yes
zheng-metrics OK yes
zheng-metrics-servlet OK yes
zheng-rest OK yes
zheng-shiro OK yes
zheng-shiro-web OK yes
zheng-shiro-jaxrs OK yes
zheng-log-logback OK yes
zheng-jdbc OK yes
zheng-migrate-flyway OK yes
zheng-migrate-liquibase OK yes
zheng-jdbc-jooq OK yes
zheng-jdbc-querydsl OK yes
zheng-jdbc-jdbi OK yes
zheng-jdbc-sql2o OK yes
zheng-jdbc-commons-dbutils OK yes
zheng-jdbc-ebean OK yes
zheng-jpa-hibernate OK yes
zheng-jpa-eclipselink OK yes
zheng-mybatis OK yes
zheng-event-guava OK yes
zheng-validator-hibernate OK yes
zheng-validator-bval OK yes
zheng-job OK yes
zheng-remote-config OK yes

zhengframework's People

Contributors

dependabot[bot] avatar ysykzheng avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

zhengframework's Issues

improve documentation

  • zheng-configuration
  • zheng-cache
  • zheng-bom
  • zheng-web
  • zheng-web-jetty
  • zheng-web-undertow
  • zheng-metrics
  • zheng-swagger
  • zheng-rabbitmq
  • zheng-healthcheck
  • zheng-mongodb
  • zheng-memcached
  • zheng-redis
  • zheng-mybatis
  • zheng-metrics-servlet
  • zheng-rest
  • zheng-webjars
  • zheng-jdbc
  • zheng-shiro
  • zheng-core
  • zheng-bootstrap
  • zheng-configuration-metrics
  • zheng-cache-cache2k
  • zheng-cache-caffeine
  • zheng-cache-ehcache
  • zheng-cache-infinispan
  • zheng-cache-commons-jcs
  • zheng-cache-hazelcast
  • zheng-cache-ignite
  • zheng-migrate-flyway
  • zheng-migrate-liquibase
  • zheng-jdbc-jooq
  • zheng-jdbc-querydsl
  • zheng-jdbc-jdbi
  • zheng-jpa
  • zheng-jpa-hibernate
  • zheng-jpa-eclipselink
  • zheng-jpa-test
  • zheng-jdbc-sql2o
  • zheng-jdbc-commons-dbutils
  • zheng-shiro-web
  • zheng-shiro-jaxrs
  • zheng-log-logback
  • zheng-jdbc-core
  • zheng-test
  • zheng-event
  • zheng-event-guava
  • zheng-validator
  • zheng-validator-hibernate
  • zheng-validator-bval
  • zheng-validator-test
  • zheng-module-template
  • zheng-jdbc-ebean
  • zheng-job
  • zheng-remote-config

transaction logic abstraction consistent

jpa transaction logic use com.google.inject.persist.Transactional
mybatis transaction logic use org.mybatis.guice.transactional.Transactional

Should be unified

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.