Code Monkey home page Code Monkey logo

nutz's Introduction

Nutz

Build Status Circle CI Coverity Scan Build Status Maven Central codecov.io GitHub release License

对于 Java 程序员来说,除 SSH 之外,的另一个选择

Talk is cheap. Show me the code!!

项目目标

在力所能及的情况下,最大限度的提高 Web 开发人员的生产力。

项目各种资源地址

现已通过 Oracle JDK 8、Oracle JDK 7、OpenJDK 7、OpenJDK 6下的 maven 测试,请查阅 Travis CI地址CircleCI地址

基于注解配置

MainModule主配置类

@SetupBy(value=MainSetup.class)
@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/",
										   "*anno", "net.wendal.nutzbook",
										   "*quartz",
										   "*async",
										   "*tx"
										   })
@Modules(scanPackage=true)
@ChainBy(args="mvc/nutzbook-mvc-chain.js")
@Ok("json:full")
@Fail("jsp:jsp.500")
@Localization(value="msg/", defaultLocalizationKey="zh-CN")
@Views({BeetlViewMaker.class})
@SessionBy(ShiroSessionProvider.class)
public class MainModule {
}

入口方法

  @At
  @RequiresPermissions("user:delete")
  @Aop(TransAop.READ_COMMITTED)
  @Ok("json")
  public Object delete(@Param("id")int id) {
    int me = Toolkit.uid();
    if (me == id) {
      return new NutMap().setv("ok", false).setv("msg", "不能删除当前用户!!");
    }
    dao.delete(User.class, id); // 再严谨一些的话,需要判断是否为>0
    dao.clear(UserProfile.class, Cnd.where("userId", "=", me));
    return new NutMap().setv("ok", true);
  }

非MVC环境下的NutDao -- DaoUp类

// 初始化DaoUp类
DaoUp.me().init(("db.properties"));

Dao dao = DaoUp.me().dao();
dao.insert("t_user", Chain.make("id", 1).add("nm", "wendal").add("age", 30));
List<Record> users = dao.query("t_user", Cnd.where("age", "<", 25).desc("nm"));

List<User> girls = dao.count(User.class, Cnd.where("age", "<", 25).and("sex", "=", "female"));

// 程序结束前销毁
DaoUp.me().close();

Maven 资源

稳定发布版本

		<dependency>
			<groupId>org.nutz</groupId>
			<artifactId>nutz</artifactId>
			<version>1.r.56.r3</version>
		</dependency>

快照版本在每次提交后会自动deploy到sonatype快照库,享受各种bug fix和新功能

	<repositories>
		<repository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>
	<dependencies>
		<dependency>
			<groupId>org.nutz</groupId>
			<artifactId>nutz</artifactId>
			<version>1.r.57-SNAPSHOT</version>
		</dependency>
		<!-- 其他依赖 -->
	</dependencies>

也可以将repositories配置放入$HOME/.m2/settings.xml中

或者直接去快照库下载

Android下使用nutz时的注意事项

  • Dao基于JDBC API,所以无法工作
  • AOP在Android的类加载机制下无法使用
  • Scans及Ioc中类扫描机制,是不能工作的

混淆时需要加入的配置

### for nutz
-keepattributes Signature
-dontwarn org.nutz.**

-keep class org.nutz.castor.** { *; }
-keep interface org.nutz.castor.** { *; }

# 以下的按需选用
#-keep class org.nutz.lang.** { *; }
#-keep class org.nutz.log.** { *; }
#-keep class org.nutz.http.** { *; }
#-keep class org.nutz.json.** { *; }
#-keep class org.nutz.mapl.** { *; }
# 或直接使用全家桶
#-keep class org.nutz.** { *; }

Sponsorship

YourKit supports open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.

YourKit Logo

JetBrains IntelliJ IDEA

http://www.jetbrains.com

nutz's People

Contributors

wendal avatar zozoh avatar juqkai avatar ywjno avatar pangwu86 avatar lifecube avatar amosleaf avatar mccxj avatar rekoe avatar ming300 avatar xing-kenny avatar happyday517 avatar qinerg avatar hzl7652 avatar insidezhou avatar xiaofengfu avatar georgekankava avatar satellite168 avatar denghuafeng avatar landraxee avatar shevawen avatar sjbwylbs avatar kerbores avatar zccm avatar wangyuehong avatar wenzhihong2003 avatar superhanliu avatar sunhai1988 avatar qinains avatar lzxz1234 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

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.