kandi background
Explore Kits

spring-boot-demo | 该项目已成功集成 actuator、admin、logback、aopLog、统一异常处理、freemarker、thymeleaf、Beetl、Enjoy、JdbcTemplate、JPA、mybatis、通用Mapper、PageHelper、mybatisplus、BeetlSQL、uploa | Object-Relational Mapping library

 by   xkcoding Java Version: Current License: MIT

 by   xkcoding Java Version: Current License: MIT

Download this library from

kandi X-RAY | spring-boot-demo Summary

spring-boot-demo is a Java library typically used in Utilities, Object-Relational Mapping, Spring Boot, Spring applications. spring-boot-demo has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub.
该项目已成功集成 actuator(监控)、admin(可视化监控)、logback(日志)、aopLog(通过AOP记录web请求日志)、统一异常处理(json级别和页面级别)、freemarker(模板引擎)、thymeleaf(模板引擎)、Beetl(模板引擎)、Enjoy(模板引擎)、JdbcTemplate(通用JDBC操作数据库)、JPA(强大的ORM框架)、mybatis(强大的ORM框架)、通用Mapper(快速操作Mybatis)、PageHelper(通用的Mybatis分页插件)、mybatis-plus(快速操作Mybatis)、BeetlSQL(强大的ORM框架)、upload(本地文件上传和七牛云文件上传)、redis(缓存)、ehcache(缓存)、email(发送各种类型邮件)、task(基础定时任务)、quartz(动态管理定时任务)、xxl-job(分布式定时任务)、swagger(API接口管理测试)、security(基于RBAC的动态权限认证)、SpringSession(Session共享)、Zookeeper(结合AOP实现分布式锁)、RabbitMQ(消息队列)、Kafka(消息队列)、websocket(服务端推送监控服务器运行信息)、socket.io(聊天室)、ureport2(中国式报表)、打包成war文件、集成 ElasticSearch(基本操作和高级查询)、Async(异步任务)、集成Dubbo(采用官方的starter)、MongoDB(文档数据库)、neo4j(图数据库)、docker(容器化)、JPA多数据源、Mybatis多数据源、代码生成器、GrayLog(日志收集)、JustAuth(第三方登录)、LDAP(增删改查)、动态添加/切换数据源、单机限流(AOP + Guava RateLimiter)、分布式限流(AOP + Redis + Lua)、ElasticSearch 7.x(使用官方 Rest High Level Client)、HTTPS、Flyway(数据库初始化)、UReport2(中国式复杂报表)。
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • spring-boot-demo has a medium active ecosystem.
  • It has 23154 star(s) with 8020 fork(s). There are 967 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 65 open issues and 69 have been closed. On average issues are closed in 27 days. There are 21 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of spring-boot-demo is current.
spring-boot-demo Support
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping
spring-boot-demo Support
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping

quality kandi Quality

  • spring-boot-demo has 0 bugs and 0 code smells.
spring-boot-demo Quality
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping
spring-boot-demo Quality
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping

securitySecurity

  • spring-boot-demo has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • spring-boot-demo code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
spring-boot-demo Security
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping
spring-boot-demo Security
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping

license License

  • spring-boot-demo is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
spring-boot-demo License
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping
spring-boot-demo License
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping

buildReuse

  • spring-boot-demo releases are not available. You will need to build from source code and install.
  • Build file is available. You can build the component from source.
  • spring-boot-demo saves you 10925 person hours of effort in developing the same functionality from scratch.
  • It has 22154 lines of code, 1002 functions and 588 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
spring-boot-demo Reuse
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping
spring-boot-demo Reuse
Best in #Object-Relational Mapping
Average in #Object-Relational Mapping
Top functions reviewed by kandi - BETA

kandi has reviewed spring-boot-demo and discovered the below as its top functions. This is intended to give you an instant insight into spring-boot-demo implemented functionality, and help decide if they suit your requirements.

  • Generate generator code .
  • Convert a string to a numeric format
  • Check if the given request should be overridden .
  • Logs asynchronously .
  • Save training data .
  • Verify password .
  • Build lock key .
  • Check if the user has permission
  • parse JWT
  • Returns a page of tables .

spring-boot-demo Key Features

该项目已成功集成 actuator(监控)、admin(可视化监控)、logback(日志)、aopLog(通过AOP记录web请求日志)、统一异常处理(json级别和页面级别)、freemarker(模板引擎)、thymeleaf(模板引擎)、Beetl(模板引擎)、Enjoy(模板引擎)、JdbcTemplate(通用JDBC操作数据库)、JPA(强大的ORM框架)、mybatis(强大的ORM框架)、通用Mapper(快速操作Mybatis)、PageHelper(通用的Mybatis分页插件)、mybatis-plus(快速操作Mybatis)、BeetlSQL(强大的ORM框架)、upload(本地文件上传和七牛云文件上传)、redis(缓存)、ehcache(缓存)、email(发送各种类型邮件)、task(基础定时任务)、quartz(动态管理定时任务)、xxl-job(分布式定时任务)、swagger(API接口管理测试)、security(基于RBAC的动态权限认证)、SpringSession(Session共享)、Zookeeper(结合AOP实现分布式锁)、RabbitMQ(消息队列)、Kafka(消息队列)、websocket(服务端推送监控服务器运行信息)、socket.io(聊天室)、ureport2(中国式报表)、打包成war文件、集成 ElasticSearch(基本操作和高级查询)、Async(异步任务)、集成Dubbo(采用官方的starter)、MongoDB(文档数据库)、neo4j(图数据库)、docker(容器化)、JPA多数据源、Mybatis多数据源、代码生成器、GrayLog(日志收集)、JustAuth(第三方登录)、LDAP(增删改查)、动态添加/切换数据源、单机限流(AOP + Guava RateLimiter)、分布式限流(AOP + Redis + Lua)、ElasticSearch 7.x(使用官方 Rest High Level Client)、HTTPS、Flyway(数据库初始化)、UReport2(中国式复杂报表)。

Community Discussions

Trending Discussions on spring-boot-demo
  • spring boot component bean validation @Positive not working but @NotNull works fine
  • Using jasypt-spring-boot when deplying to Apache Tomcat
Trending Discussions on spring-boot-demo

QUESTION

spring boot component bean validation @Positive not working but @NotNull works fine

Asked 2022-Jan-04 at 09:04

I have a service managed by spring, I put @Validated annotation on that service refer to this article, it tells that spring will do the validation for us, we don't even need to valid it manually.

import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
@Component
@Validated
public class MyService {
    public void execute(@Valid MyRequest request) {
            //todo
    }
}

MyRequest is a DTO which will be validated by spring

import lombok.Data;

import javax.validation.constraints.Positive;

@Data
public class MyRequest {
    @Positive(message = "id should be positive")
    private Long id;
}

here is my controller, in some reason, I don't want to do the validation in controller.

@Controller
public class MainController {
    @Autowired
    private MyService service;
    @RequestMapping(value = "/execute", method = {GET, POST})
    @ResponseBody
    public MyResponse execute() {
        MyResponse res = new MyResponse();
        service.execute(new MyRequest());
        res.setHtmlText("hello world");
        return res;
    }
}

when I visit the url: http://localhost:8001/execute it doesn't give me any exception and show the result hello world

here is the maven dependency

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.fudy</groupId>
    <artifactId>spring-boot-demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-boot-demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

however after I replace @Positive to @NotNull, it works fine

import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;

@Data
public class MyRequest {
    //@Positive(message = "id should be positive")
    @NotNull(message = "id should not be null")
    private Long id;
}

ANSWER

Answered 2022-Jan-04 at 09:04

It works as it should. The validator associated with @Positive, the PositiveValidatorForLong accepts null values as valid. So it will only validate actual values, not null.

Basically you need them both to fullfil your requirements, so both @Positive and @NotNull to only allow positive values.

pro-tip: As you already have the spring-boot-starter-validation dependency you don't need the additional validation-api and hibernate-validator dependencies, those are added already.

Source https://stackoverflow.com/questions/70574611

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install spring-boot-demo

You can download it from GitHub.
You can use spring-boot-demo like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the spring-boot-demo component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Object-Relational Mapping Libraries
Compare Object-Relational Mapping Libraries with Highest Support
Compare Object-Relational Mapping Libraries with Highest Quality
Compare Object-Relational Mapping Libraries with Highest Security
Compare Object-Relational Mapping Libraries with Permissive License
Compare Object-Relational Mapping Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.