spring boot(23) : springboot-mybatis-mysql web服务构建

Java 基于 spring boot课程评价系统 springboot+mybatis+layui 角色分为 学生、教师、管理员,学生可修改密码,先选择课程之后对对应课程的教师做出评价 运行环境 jdk8+tomcat8+mysql+IntelliJ IDEA/eclipse+maven 项目技术 springboot+mybatis+layui jar包文件 使用maven 运行访问地址: http://localhost:8080/ 管理员账号admin admin 学生... 阅读详情

简单 springboot-mybatis-mysql 构建web服务

版本

  • springboot : 2.0.3.RELEASE
  • mybatis : 1.3.1

项目结构

springboot-start
    src
        java
            cn.nordrassil.start.controller
                SystemController.java 
            cn.nordrassil.start.repository.entity
            cn.nordrassil.start.repository.mapper
            Application.java
        reposources
            mapper
            application.properties
    pom.xml

pom.xml

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>cn.nordrassil</groupId>
    <artifactId>springboot-start</artifactId>
    <version>1.0-SNAPSHOT</version>


    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
        <mybatis-spring-boot.version>1.3.1</mybatis-spring-boot.version>
        <jackson.version>2.9.8</jackson.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>${mybatis-spring-boot.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
    </dependencies>

    <build>
        <finalName>springboot-start</finalName>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.yml</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.yml</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!-- 指定该Main Class为全局的唯一入口 -->
                    <mainClass>cn.nordrassil.start.Application</mainClass>
                    <layout>ZIP</layout>
                    <includeSystemScope>true</includeSystemScope><!-- 把第三方jar包打进去 -->
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中 -->
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>

application.properties

server.port=8001

mybatis.configuration.map-underscore-to-camel-case=true
mybatis.mapper-locations=classpath:mapper/*.xml

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf-8&amp;useSSL=false&amp;allowMultiQueries=true
spring.datasource.username=root
spring.datasource.password=root

Application.java

package cn.nordrassil.start;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(scanBasePackages = {"cn.nordrassil.start"})
@MapperScan(basePackages = {"cn.nordrassil.start.repository.mapper"})
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

SystemController.java

package cn.nordrassil.start.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: liyue
 * @Date: 2020/4/27 15:13
 * @Description:
 */
@RestController
public class SystemController {

    public final static String SUCCESS = "SUCCESS";

    @RequestMapping("/live")
    public String live() {
        return SUCCESS;
    }
}

logback-spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
    <springProperty scope="context" name="appName" source="spring.application.name" defaultValue="app"/>
    <springProperty scope="context" name="logFileDir" source="logging.path" defaultValue="logs"/>

    <!-- 目前约定profile:dev:开发, test:测试, produce:生产 -->

    <!-- 当前日志存放路径(路径末尾不要带“/”),设置默认值 -->
    <property name="LOG_FILE_DIR" value="${logFileDir}/${appName}"/>
    <!-- 历史归档日志存放路径(路径末尾不要带“/”),设置默认值 -->
    <property name="HIS_LOG_FILE_DIR" value="${logFileDir}/${appName}/history"/>

    <!-- You can override this to have a custom pattern -->
    <property name="CONSOLE_LOG_PATTERN"
              value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>

    <!-- Appender to log to console -->
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <!-- Minimum logging level to be presented in the console logs-->
            <level>DEBUG</level>
        </filter>
        <encoder>
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
            <charset>utf8</charset>
        </encoder>
    </appender>

    <!-- 文件输出 -->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_FILE_DIR}/${appName}.log</file>
        <append>true</append>
        <!--定义日志滚动的策略-->
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <!-- 日志最大的历史 30天 -->
            <maxHistory>30</maxHistory>
            <!--每个日志文件最大500MB-->
            <maxFileSize>500MB</maxFileSize>
            <!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
            <totalSizeCap>20GB</totalSizeCap>
            <fileNamePattern>${HIS_LOG_FILE_DIR}/${appName}.%d{yyyy-MM-dd}.log.%i.gz</fileNamePattern>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%level|%logger{36}:%line|%thread|%X{traceId}|%msg%n</pattern>
        </encoder>
    </appender>

    <appender name="asyncLoggerAppender" class="ch.qos.logback.classic.AsyncAppender">
        <!--定义了一个过滤器,在LEVEL之下的日志输出不会被打印出来-->
        <!--这里定义了INFO,也就是文件不会输出比INFO级别小的日志-->
        <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
             <level>INFO</level>
         </filter>-->
        <discardingThreshold>0</discardingThreshold>
        <queueSize>1024</queueSize>
        <neverBlock>true</neverBlock>
        <appender-ref ref="FILE"/>
    </appender>

    <springProfile name="dev">
        <root level="INFO">
            <appender-ref ref="console"/>
        </root>
    </springProfile>

    <springProfile name="prod">
        <root level="INFO">
            <appender-ref ref="asyncLoggerAppender"/>
        </root>
    </springProfile>
</configuration>

运行

直接运行 Application.java即可启动项目

测试

访问下面地址获得反馈既说明运行成功

http://127.0.0.1:8001/live

打包

项目根路径下执行如下命令即可完成打包

mvn clean package

部署

打包之后在 targe 文件夹中会生成.jar文件,执行如下命令即可完成部署

nohup java -jar springboot-start.jar  &

END。

mybatis-boot-starter-mysql-connector-java 是一个集成了 MyBatis、Spring Boot 和 MySQL 数据库连接驱动的 Maven 依赖库 mybatis-boot-starter-mysql-connector-java 是一个集成了 MyBatis、Spring Boot 和 MySQL 数据库连接驱动的 Maven 依赖库。通过这个 starter,开发者可以快速地配置和使用 MyBatis,而不需要手动添加多个依赖和进行繁琐的配置。要将 mybatis-spring-boot-starter 和 mysql-connector-java 添加到 Maven 项目中,你需要在项目的 pom.xml 文件中添加相应的依赖项。 阅读详情

相关推荐

Java工程师为何回归IDEA:SpringBoot+MyBatis深度开发不可替代的确定性

在Java后端开发中,IDE不仅是代码编辑器,更是理解SpringBoot自动装配、MyBatis映射语义和JVM类结构的核心基础设施。其底层依赖PSI语法树解析、Spring Boot元数据索引与MyBatis XML Schema校验等编译器级能力,实现方法跳转、配置补全、动态SQL实时校验等高确定性功能。相比基于LLM文本续写的AI辅助工具(如Cursor),IDEA能精准识别@ConditionalOnProperty条件绑定、@TableField字段映射缺失、Optional空值风险等工程隐患,

weixin_33861800的博客 385

通过idea创建spring-boot、mybatis、MySQL的web项目

首先、创建项目; 在这里选择Maven项目也可以,但是IDEA为我们提供了一种更方便快捷的创建方法,即Spring Initializr。可以在这里选择Spring Initializr,选择后点击Next next后就是填写项目信息,之后再next next后跳转到了选择依赖的界面,我这边以创建web项目为例,数据库用MySQL、持久层框架是mybatis,依赖选择完成后点击n...

weixin_41996755的博客 1538

SpringBoot+MyBatis-Plus快速集成避坑指南

SpringBoot与MyBatis-Plus整合是Java后端开发的基础能力,其核心在于理解自动配置原理、依赖冲突机制及运行时Bean生命周期。技术价值体现在降低单表CRUD开发成本、统一SQL审计与逻辑删除语义,并支撑高并发场景下的事务一致性。典型应用场景包括微服务用户中心、内容管理后台及IoT设备数据接入层。实践中需重点关注JDK版本兼容性、MySQL字符集配置、MyBatis-Plus主键策略(如id-type: auto)与逻辑删除(@TableLogic)的底层SQL重写机制,避免因环境差异或配

lizaochengwen的专栏 432

idea+springboot+mybatis+mysql开发web项目

第一步:创建springboot初始demo     一直到这里,选择web中的web, 还有SQL中的Mysql+Mybatis   至此,基于springboot集成MySQL,mybatis的web启动项目算是完成了。 ps:如果是首次建立,maven仓库没有相关依赖,可能它会花点时间去下载依赖包   启动主程序类   你会发现,启动报错,没有数据源???,在...

Fiver的博客 6588

Spring Boot入门(08):如何用Spring Boot和MyBatis实现高效MySQL增删改查操作?

Spring Boot是一款非常流行的Java开发框架,MyBatis是一款高效的数据库操作框架,二者结合可以实现快速、高效的MySQL增删改查操作。本文将介绍如何通过Spring Boot和MyBatis搭建一个简单的MySQL增删改查示例,涉及基本的CRUD操作、事务管理和数据分页等内容,有助于Java开发者快速掌握这两个框架的用法,提高开发效率和代码质量。

**My Coding Family** 1万+

置顶必读(1) |《滚雪球学 Spring Boot 4.x》专栏目录导航篇(持续更新中)!

🏆 本文收录于 《滚雪球学 Spring Boot 4.x》 专栏。 本专栏面向 有一点 Java 基础,但没有系统学过 Spring Boot 的读者,采用“滚雪球式学习法”:先跑通、再理解、再重构、再上线,最终带你从第一个 Hello API 一路完成一个可部署、可监控、可扩展的后端项目。

**My Coding Family** 8万+

spring boot搭建web项目连接mysql数据库

三生石龙   博客园 首页 新随笔 联系 订阅 管理 idea+springboot+Mybatis搭建web项目 使用idea+springboot+Mybatis搭建一个简单的web项目。 首先新建一个项目; 在这里选择Maven项目也可以,但是IDEA为我们提供了一种更方便快捷的创建方法,即Spring Initializr。选择后点击Next; 把项目信息...

qq_29950673的博客 2578

RedPitaya火龙果板基础操作

火龙果板基础操作一级目录二级目录三级目录 一级目录 二级目录 三级目录

qq_41523340的博客 9761

搭建springBoot + JPA + mysql 的web项目

说明:此篇文章不算是纯技术文,自己心血来潮想搭建这么一个项目,东翻西找,这看看那看看,写了一个小demo,前后台交互,数据库访问包括事物管控均已测试通过。在此分享,希望初识springboot或jpa的同学能有个基本的搭建思路,也算是给自己留个笔记吧。 搭建过程正式开始: 1.首先是项目结构,就是正常的一个maven项目的结构 2.pom.xml的配置 (1)springboot和we...

windon12345的专栏 4712

从安装到出图:一份给振动测试新手的LMS Test.Lab 2021完整避坑手册(含许可证更新和常见弹窗解决)

本文为振动测试新手提供LMS Test.Lab 2021的完整使用指南,涵盖安装配置、许可证更新、数据采集到频域后处理的全流程。特别针对常见弹窗错误提供解决方案,并详细讲解Colormap时频图分析技巧,帮助用户快速掌握振动数据分析核心技能。

weixin_29268331的博客 1061

螺丝锁付系统软件设计 C# Winform

视觉螺丝锁付系统软件设计 C# Winform ,这是其中通信子模块设计

weixin_42522973的博客 345

Spring Boot+Hibernate创建一个对MySQL实现简单的增删改查的功能。

数据库设计 create table test( u_id int auto_increment PRIMARY key, u_name varchar(20), u_pass varchar(20) ) insert into user(u_name,u_pass) values("zhao",123456),("zhao1","112233") entity(user) @Entity public class user { @Id @GeneratedValue pri

微笑的博客 553

实战详细讲解Qt插件plugin的编写与用法

qt插件的开发,可以说是动态库的开发,因为调用方式类似,多熟悉一下,利用Qt框架开发很简单的。在想想这种调用过程有的熟悉,比如公司买了一堆摄像头,公司要对摄像头进行二次开发,实现自己想要的功能,集成到一套设备里去,然后在卖给用户。此时厂商肯定会提供开发文档,并给你SDK包(软件开发工具包), 包里你会发现只有头文件和一堆库文件,没有源文件,因为实现的过程是产商公司保密的,给你看还得了。所以都封装成了库的形式给你调用,如静态库或者动态库。

qq_44667165的博客 1万+

springboot整合mybatis(一)入门

mybatis

xiatianit的博客 3036

【数据集】未来不同情景下预测数据:如人口、土地利用等

未来不同情景下预测数据:如人口、土地利用等

WW、forever的博客 3003

【教程4>第5章>第19节】基于Gardner环的位同步系统MATLAB仿真与带时偏基带数据导出

由于在FPGA中,时偏的影响主要是由系统收发两端晶振的不同步带来的,所以在仿真测试阶段,很难直接通过FPGA来模拟这个因素,所以我们采用MATLAB模拟带时偏的基带输入信号,并将其导出,由FPGA调用作为测试信号源。可以看到,同步之后(图3)相对于带时偏的基带信号(图2),其更接近标准的数据(图1),且抖动较小。订阅过的朋友可以复习下这个课程,没有订阅的朋友,也可以直接复制如下的程序进行仿真测试。上述程序中,加入时偏的基带信号,通过子函数。同步之后,可以恢复出标准的QPSK星座图。

FPGA/MATLAB学习教程/源码/项目合作开发 535

黑马程序员JavaWeb开发教程,实现javaweb企业开发全流程(涵盖Spring+MyBatis+SpringMVC+SpringBoot等)

感谢黑马,感谢努力的自己,终将成为黑马。

qq_69325307的博客 7020

【AI智能体】Codex 浏览器操作自动化任务实战操作详解

【AI智能体】Codex 浏览器操作自动化任务实战操作详解

congge 4334

【SpringBoot框架篇】14.mybatis-plus实战

文章目录简介版本使用模板生成器生成模板代码添加依赖创建表创建模板实体类的超类添加模板生成器代码运行main函数使用mybatis-plus实现基本的CRUD功能通用代码层service代码详解mapper控制器层调用接口自定义分页条件注入器页面查询条件注入代码配套代码已上传到github上 简介 Mybatis-Plus(简称MP)是一个 Mybatis 的增强工具,在 Mybatis 的基础上只做增强不做改变,为简化开发、提高效率而生。这是官方给的定义,关于mybatis-plus的更多介绍及特性,可以参

皓亮君的博客 2734

10、边缘智能学习技术解析

本文深入解析了边缘智能学习技术的四大核心方法:联邦学习、DNN拆分、迁移学习和八卦学习。文章从人类大脑的学习机制出发,引出边缘级智能的重要性,并详细阐述各类技术的架构、优势、挑战及适用场景。通过对比分析,展示了不同技术在隐私性、效率、可扩展性等方面的特性,并探讨了未来融合多种技术、软硬件协同优化及应用领域拓展的发展趋势,为边缘智能在物联网与人工智能领域的应用提供了系统性参考。

ppp33的博客 122

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

如何在Spring Boot中配置和使用MyBatis-Plus

通过以上步骤,你已经成功配置并使用了MyBatis-Plus与Spring Boot的结合。MyBatis-Plus为开发人员提供了简化的操作方式,减少了很多样板代码,让开发变得更加高效。在实际项目中,你可以根据需求灵活运用MyBatis-Plus的各种功能,快速构建出高效、可维护的应用。希望这篇文章能帮助你更好地理解Spring Boot和MyBatis-Plus的使用,快去实践一下吧!

字节王德发 1140

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

[Spring Boot + MyBatis + MySQL框架搭建]

《春晓》 唐·孟浩然 春眠不觉晓,处处闻啼鸟。夜来风雨声,花落知多少。

汤圆的博客 1323

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

Spring Boot 实战:MyBatis 操作数据库

摘要: 2026年Spring Boot项目数据库操作主流方案包括JPA/Hibernate、MyBatis和MyBatis-Plus。本文重点对比纯MyBatis与MyBatis-Plus两种实现方式,提供从项目初始化到生产可用的完整指南。通过Maven依赖配置、YAML文件示例,详细演示了两种方案的实现差异:纯MyBatis需手动编写SQL和XML映射,而MyBatis-Plus通过注解和内置方法实现零SQL的CRUD操作,显著提升开发效率。文章包含实体类定义、Mapper接口编写、动态SQL处理以及自

m0_57545130的博客 507

(课程设计)spring boot小说网站系统 毕业设计 附源码 041446

管理员账户的基本信息管理。主要提供管理员账户的基本信息录入、删除、维护和查询等功能,包括: 管理员录入管理员账户基本信息; 管理员更新、增加及删除管理员账户基本信息; 用户根据管理员账户 ID 查询基本信息; 系统管理员更改个人密码; 留言的基本信息管理。主要提供留言的基本信息录入、修改和查询功能,包括: 用户录入留言基本信息; 管理员更新、增加及删除留言基本信息; 评论的基本信息管理。主要提供评论的基本信息录入、修改和查询功能,包括: 用户录入评论基本信息; 管理员更新、增加及删除评论基本信息; ..

ID3461074420的博客 5506

(附源码)spring boot考试系统-毕业设计 课程设计 191015

(1)考试系统,考试信息维护,用户维护和个人信息维护管理员可以往题中添加考题,修改错误试题和删除无用试题,考试系统包括单选题管理(单选题添加、删除、修改)、判断题管理(判断题添加、删除、修改)、多选题管理(多选题添加、删除、修改)。 (2)考试信息的维护 考试信息的维护主要是对于考试设置信息进行维护,这些信息主要是考试总时间,试题数量,各试题分值的分布等。 (3)用户维护 系统管理员可以对用户信息(包括考生信息)进行增,删,改查操作。 (4)个人信息维护 管理员也可以对自己的基本信息的维护。

Q_3461074420的博客 4141

基于Spring Boot与Vue的水果销售系统的设计与实现-计算机毕设 【课程设计】12720

前端注册用户模块: (1)注册登录:注册和登录是用户进入系统的门户,它们是用户与系统交互的首要步骤。注册功能允许新用户创建账户,而登录功能则允许已注册用户进入他们的个人空间。 (2)首页:首页是用户进入平台后首先看到的页面,它为用户提供了一个直观的界面,展示平台的核心内容和功能。首页包括水果资讯和水果商城的推荐商品。首页的设计吸引用户深入浏览,提供丰富的信息和便捷的入口,让用户能够快速找到他们感兴趣的内容或商品。 (3)公告信息:公告信息模块是平台与用户沟通的重要渠道,用于发布最新的平台通知、活动信息、政策

WeiXin_DZbishe的博客 1776
上一篇: spring boot(23) : 条件化注入
下一篇: spring boot(24) : 缓存cache使用
楽焫旒璡
博客等级 码龄10年 357粉丝 365原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值