摘要: “provided”表示只用于编译和测试,打包不包含此依赖。然后,需要给IDEA安装Lombok插件 阅读全文
posted @ 2022-12-13 22:22 cnetsa 阅读(138) 评论(0) 推荐(0)
摘要: @Value和@ConfigurationProperties 阅读全文
posted @ 2022-12-13 22:21 cnetsa 阅读(28) 评论(0) 推荐(0)
摘要: Spring Boot环境准备主要包括安装JDK、安装Maven、安装IntelliJ IDEA。 1.安装JDK JDK是Java编译运行时必不可少的工具。想要编写Spring Boot应用,第一步就是安装JDK。有关JDK的安装可以参考JDK官方教程。 2.安装Maven Maven是一个强大的 阅读全文
posted @ 2022-12-13 22:07 cnetsa 阅读(45) 评论(0) 推荐(0)
摘要: 10.spring-boot-devtools spring-boot-devtools是开发者工具模块,主要为Spring Boot开发阶段提供一些特性,如修改了代码自动重启应用等。这个模块的功能是可选的,仅限于本地开发阶段使用,当用构建的jar包运行时这些功能会被禁用。 阅读全文
posted @ 2022-12-13 22:06 cnetsa 阅读(58) 评论(0) 推荐(0)
摘要: 9.spring-boot-loader spring-boot-loader可以用来构建一个单独可执行的jar包,使用java -jar就能直接运行。也可以使用Spring Boot提供的Maven或者Gradle插件来构建jar包。 阅读全文
posted @ 2022-12-13 22:05 cnetsa 阅读(56) 评论(0) 推荐(0)
摘要: 8.spring-boot-test-autoconfigure spring-boot-test-autoconfigure用于为spring-boot-test测试模块提供自动配置。 阅读全文
posted @ 2022-12-13 22:05 cnetsa 阅读(37) 评论(0) 推荐(0)
摘要: 7.spring-boot-test spring-boot-test是Spring Boot测试模块,为应用测试提供了许多非常有用的核心功能。 阅读全文
posted @ 2022-12-13 22:05 cnetsa 阅读(63) 评论(0) 推荐(0)
摘要: 6.spring-boot-actuator-autoconfigure spring-boot-actuator-autoconfigure用于为spring-boot-actuator执行端点提供自动配置。 阅读全文
posted @ 2022-12-13 22:04 cnetsa 阅读(69) 评论(0) 推荐(0)
摘要: 5.spring-boot-actuator spring-boot-actuator是Spring Boot提供的执行端点,包括健康端点、环境端点、Spring Bean端点等 阅读全文
posted @ 2022-12-13 22:04 cnetsa 阅读(42) 评论(0) 推荐(0)
摘要: 4.spring-boot-cli spring-boot-cli是Spring Boot的命令行工具,用于编译和运行Groovy源程序,使用它可以十分简单地编写并运行一个应用程序。它也能监控你的文件,一旦有变动就会自动重新编译并重新启动应用程序。 阅读全文
posted @ 2022-12-13 22:04 cnetsa 阅读(41) 评论(0) 推荐(0)
摘要: spring-boot-starters是Spring Boot的启动器,它可以一站式打包Spring及相关技术应用,而不需要开发者到处寻找依赖和示例来配置代码。 开发者只要启动spring-boot-starters 中的spring-boot-starter-web启动器,该模块就会自动配置 W 阅读全文
posted @ 2022-12-13 22:04 cnetsa 阅读(35) 评论(0) 推荐(0)
摘要: spring-boot-autoconfigure能根据类路径下的内容自动配置,提供的@EnableAutoConfiguration注解能启用Spring Boot的自动配置功能。自动配置功能可以推断开发者可能需要加载哪些Spring Bean,例如,如果类路径下有一个连接池的包,此时并未提供任何 阅读全文
posted @ 2022-12-13 22:03 cnetsa 阅读(202) 评论(0) 推荐(0)
摘要: spring-boot是Spring Boot的主模块,也是支持其他模块的核心模块,主要功能包含以下几点。 (1)提供了一个用于启动 Spring 应用的主类,它的主要作用是创建和刷新Spring容器的上下文。 (2)提供了内嵌式的并可自由选择搭配的Web应用容器,例如,Tomcat、Jetty、U 阅读全文
posted @ 2022-12-13 22:02 cnetsa 阅读(39) 评论(0) 推荐(0)
摘要: import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 阅读全文
posted @ 2022-12-13 14:20 cnetsa 阅读(65) 评论(0) 推荐(0)
摘要: <!-- JPA的依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> 阅读全文
posted @ 2022-12-13 13:47 cnetsa 阅读(48) 评论(0) 推荐(0)
摘要: <!-- Springboot整合mybatis依赖--> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1. 阅读全文
posted @ 2022-12-13 13:47 cnetsa 阅读(119) 评论(0) 推荐(0)
摘要: <!-- thymeleaf整合依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> 阅读全文
posted @ 2022-12-13 13:47 cnetsa 阅读(51) 评论(0) 推荐(0)
摘要: <!-- 打包方式--> <!-- <packaging>war</packaging>--> <packaging>jar</packaging> <!-- 新版本SpringBoot为什么去掉了Parent依赖 maven有继承关系,它跟java中类继承关系是一样的,可以进行子继承父依赖。 -- 阅读全文
posted @ 2022-12-13 13:46 cnetsa 阅读(36) 评论(0) 推荐(0)
摘要: <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo</name> <d 阅读全文
posted @ 2022-12-13 13:46 cnetsa 阅读(36) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>thymeleaf</title> </head> <body> <!-- 获取变量-- 阅读全文
posted @ 2022-12-13 13:46 cnetsa 阅读(28) 评论(0) 推荐(0)
摘要: /** * @RestController: 复合注解,表示该类中所有的方法返回的数据类型都是json * * @RestController = @Controller + @ResponseBody * * REST API注解: @GetMapping、@PostMapping、@PutMap 阅读全文
posted @ 2022-12-13 13:36 cnetsa 阅读(50) 评论(0) 推荐(0)
摘要: import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties 阅读全文
posted @ 2022-12-13 13:34 cnetsa 阅读(32) 评论(0) 推荐(0)
摘要: import javax.validation.constraints.Pattern; @Pattern 阅读全文
posted @ 2022-12-13 13:33 cnetsa 阅读(67) 评论(0) 推荐(0)
摘要: import org.hibernate.validator.constraints.Range; @Range 阅读全文
posted @ 2022-12-13 13:33 cnetsa 阅读(54) 评论(0) 推荐(0)
摘要: import javax.validation.constraints.NotBlank; @NotBlank 阅读全文
posted @ 2022-12-13 13:31 cnetsa 阅读(48) 评论(0) 推荐(0)
摘要: JSP的依赖 <!-- JSP的依赖--> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency> 阅读全文
posted @ 2022-12-13 12:01 cnetsa 阅读(83) 评论(0) 推荐(0)
摘要: JSR-303校验 <!-- JSR-303校验--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </depende 阅读全文
posted @ 2022-12-13 12:00 cnetsa 阅读(38) 评论(0) 推荐(0)
摘要: <!-- 数据源信息--> <!-- <dependency>--> <!-- <groupId>org.springframework.boot</groupId>--> <!-- <artifactId>spring-boot-starter-jdbc</artifactId>--> <!-- 阅读全文
posted @ 2022-12-13 11:58 cnetsa 阅读(61) 评论(0) 推荐(0)
摘要: <!-- 监控--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> 阅读全文
posted @ 2022-12-13 11:57 cnetsa 阅读(47) 评论(0) 推荐(0)
摘要: pom之 热部署spring-boot-devtools <!-- 热部署 Ctrl+Shift+Alt+/ --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</ 阅读全文
posted @ 2022-12-13 11:57 cnetsa 阅读(54) 评论(0) 推荐(0)
摘要: spring-boot-starter-web <!-- web模块--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </depe 阅读全文
posted @ 2022-12-13 11:56 cnetsa 阅读(88) 评论(0) 推荐(0)
摘要: spring-boot-starter <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> 阅读全文
posted @ 2022-12-13 11:55 cnetsa 阅读(23) 评论(0) 推荐(0)
摘要: java版本;源码build编码。输出编码; spring-boot 版本 <properties> <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 阅读全文
posted @ 2022-12-13 11:54 cnetsa 阅读(77) 评论(0) 推荐(0)
摘要: <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo</name> <d 阅读全文
posted @ 2022-12-13 11:53 cnetsa 阅读(104) 评论(0) 推荐(0)
摘要: import org.springframework.beans.factory.annotation.Autowired; @Autowired import org.springframework.beans.factory.annotation.Value; @Value("${student 阅读全文
posted @ 2022-12-13 11:47 cnetsa 阅读(22) 评论(0) 推荐(0)
摘要: package com.example.demo.entity; import lombok.Data; import org.springframework.stereotype.Component; import org.springframework.boot.context.properti 阅读全文
posted @ 2022-12-13 11:46 cnetsa 阅读(130) 评论(0) 推荐(0)
摘要: package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** 阅读全文
posted @ 2022-12-13 11:44 cnetsa 阅读(78) 评论(0) 推荐(0)
摘要: # SpringBoot项目的配置文件 server: # 项目的运行端口号 port: 8888 servlet: # 项目访问路径 context-path: /demo 阅读全文
posted @ 2022-12-13 11:42 cnetsa 阅读(36) 评论(0) 推荐(0)
摘要: spring: # 应用名称 application: name: demo datasource: # 驱动如果是8+,那么driverClass和url都需要改变,url需要添加serverTimezone=UTC driver-class-name: com.mysql.jdbc.Driver 阅读全文
posted @ 2022-12-13 11:41 cnetsa 阅读(18) 评论(0) 推荐(0)