Spring5源码解析-搭建环境

Spring5源码之一(Spring调试起点) Spring源码调试入口 阅读详情

Spring5源码解析-搭建环境
1.获取源码:
https://github.com/spring-projects/spring-framework/tree/5.0.x
2.导入IDE
在这里插入图片描述
3.解决cglib和objensis的编译错误
在这里插入图片描述
编译cglib和objensis jar包,然后导入

在这里插入图片描述
新增的jar包在gradle有效
compile fileTree(dir:“libs”,include:".jar")
在这里插入图片描述
4.运行调试
在这里插入图片描述
遇到如下的错

Error:Kotlin: [Internal Error] java.lang.AbstractMethodError: org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar.registerProjectComponents(Lcom/intellij/mock/MockProject;Lorg/jetbrains/kotlin/config/CompilerConfiguration;)V
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:173)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:114)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment C o m p a n i o n . c r e a t e F o r P r o d u c t i o n ( K o t l i n C o r e E n v i r o n m e n t . k t : 401 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . c r e a t e C o r e E n v i r o n m e n t ( K 2 J V M C o m p i l e r . k t : 282 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . c r e a t e E n v i r o n m e n t W i t h S c r i p t i n g S u p p o r t ( K 2 J V M C o m p i l e r . k t : 272 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . d o E x e c u t e ( K 2 J V M C o m p i l e r . k t : 151 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . d o E x e c u t e ( K 2 J V M C o m p i l e r . k t : 61 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I C o m p i l e r . e x e c I m p l ( C L I C o m p i l e r . j a v a : 107 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I C o m p i l e r . e x e c I m p l ( C L I C o m p i l e r . j a v a : 51 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I T o o l . e x e c ( C L I T o o l . k t : 92 ) a t o r g . j e t b r a i n s . k o t l i n . d a e m o n . C o m p i l e S e r v i c e I m p l Companion.createForProduction(KotlinCoreEnvironment.kt:401) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:282) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:272) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:151) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:61) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:107) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:51) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92) at org.jetbrains.kotlin.daemon.CompileServiceImpl Companion.createForProduction(KotlinCoreEnvironment.kt:401)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:282)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:272)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:151)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:61)atorg.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:107)atorg.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:51)atorg.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)atorg.jetbrains.kotlin.daemon.CompileServiceImplcompileKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲ifAlive$lambda$…inlined i f A l i v e ifAlive ifAlivelambda 1. i n v o k e ( C o m p i l e S e r v i c e I m p l . k t : 96 ) a t o r g . j e t b r a i n s . k o t l i n . d a e m o n . C o m p i l e S e r v i c e I m p l 1.invoke(CompileServiceImpl.kt:96) at org.jetbrains.kotlin.daemon.CompileServiceImpl 1.invoke(CompileServiceImpl.kt:96)atorg.jetbrains.kotlin.daemon.CompileServiceImpldoCompileKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲ifAlive$lambda$…inlined i f A l i v e ifAlive ifAlivelambda$2.invoke(CompileServiceImpl.kt:96)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:919)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:891)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:378)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport 1. r u n ( T r a n s p o r t . j a v a : 197 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t s u n . r m i . t r a n s p o r t . T r a n s p o r t . s e r v i c e C a l l ( T r a n s p o r t . j a v a : 196 ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t . h a n d l e M e s s a g e s ( T C P T r a n s p o r t . j a v a : 568 ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t 1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport 1.run(Transport.java:197)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.rmi.transport.Transport.serviceCall(Transport.java:196)atsun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)atsun.rmi.transport.tcp.TCPTransportConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport C o n n e c t i o n H a n d l e r . l a m b d a ConnectionHandler.lambda ConnectionHandler.lambdarun 0 ( T C P T r a n s p o r t . j a v a : 683 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t 0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport 0(TCPTransport.java:683)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.rmi.transport.tcp.TCPTransportConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
这个主要是Kotlin插件的版本问题,解决方案是更新新版本的Kotlin插件
最后重启IDEA,然后测试调试即可正常运行。

  1. 遇到 InstrumentationSavingAgent 不存在的错误 需要将 spring-context.gradle 修改如下
    在这里插入图片描述
    在这里插入图片描述
Spring源码深度解析之通篇死磕Spring源码 Spring源码解析之前在个人小站www.jinnianshizhunian.vip中介绍过一部分,但是后来发现PC端看着并不是很方便,所以将后续的文章迁移到个人公众号,定期更新。下面是最近更新的Spring源码解析类文章,欢迎移步至公众号查看,微信搜索公众号:”菜鸟封神记“,或者扫描下面公众号关注即可。 菜鸟封神记 近期发布过以下文章,后续会持续分享更多关于Spring源码的文章,笔者已经... 阅读详情

相关推荐

Gradle 5.6.4与Spring 5.2.8源码编译实战指南

在现代Java开发中,构建工具是项目自动化构建、测试和部署的核心组件。Gradle作为新一代的构建工具,融合了Ant的灵活性与Maven的约定优于配置理念,采用基于Groovy或Kotlin DSL的声明式语法,极大地提升了构建脚本的可读性与可维护性。相较于传统工具,Gradle引入了增量构建、并行任务执行和丰富的插件生态系统,显著提升了构建效率,特别适用于大型多模块项目和持续集成环境。其灵活性和扩展性也使其成为Android官方构建工具和众多企业级项目的首选。

weixin_33816734的博客 723

spring源码下载安装,导入idea以及编译报错问题详细解决过程

参考 《spring源码深度解析 第2版》 一、spring源码下载 github官网 github首页搜索 “spring” 选择 spring-projects/spring-framework 点击 Branch master 选择5.0.x 下载源码 ZIP压缩包 Clone or download -> Download ZIP 如果由于网络问题下载不下来的话,下面是我上传...

a704397849的博客 1万+

Spring 5.2.6 全模块源码包:含Javadoc、Kotlin文档、参考手册与XSD配置文件

直接解压即用的 Spring 5.2.6 完整开发资源集合,包含全部官方模块源码(beans、context、aop、mvc、jdbc、tx、websocket、jms、cache、task、util、lang、oxm、jee、tool 等),结构清晰,支持逐层查阅实现细节。内置标准 JavaDoc(javadoc-api)和 Kotlin 友好文档(kdoc-api),方便多语言项目参考。docs 目录提供中英文双版本《Spring Framework Reference》PDF 与 HTML 手册,覆盖

flink9streamer的博客 255

Spring源码深度解析

本文对spring IOC/AOP 源码做详了细解读

qq_31359923的博客 5692

利用arpspoof + sslStrip尝试进行arp欺骗

利用arpspoof + sslStrip尝试进行arp欺骗

qq_63575829的博客 360

DDR内存条选购避坑指南:单Rank vs 双Rank性能实测对比(附2024年颗粒推荐)

本文深入解析了内存条中单Rank与双Rank设计的原理与性能差异。通过实战测试对比,揭示了双Rank内存在高负载场景(如3D渲染、视频剪辑)中凭借Rank Interleaving技术带来的显著性能优势,并提供了2024年针对不同用户需求的DDR4/DDR5内存选购策略与避坑指南。

ik678901的博客 1140

Spring源码分析

Spring源码分析

七叔的博客 2万+

[基于STM32底盘控制与ROS上层导航小车制作] 第一节 stm32电机驱动与编码器读取反馈

系列文章目录 第一节stm32电机驱动与编码器读取反馈 第二节 stm32电机pid控制 第三节 stm32线速度标定 第四节 stm32添加mpu6050得到angle角度 第五节 实现STM32与ubuntu系统下的ROS串口DMA通信,传输底盘速度等信息 第六节 ROS计算和发布里程计 提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档 目录 系列文章目录 前言 1.pwm与电机正反转 2.编码器初始化 二、pwm控制与编码器使用 1.pwm使电机 .

LanLanLan1927的博客 1万+

【spring源码】源码分析

(1)【BeanDefinition】,用来存放从配置信息中读取到的bean的信息(2)【BeanFactoryPostProcessor】接口,在把BeanDefinition的信息放进BeanFactory中创建bean之前,调用这个接口对bean信息进行修改加强处理经过这个方法处理后,bean信息中的占位符就会被修改成配置信息中的实际变量案例BeanFactoryPostProcessor对bean的定义信息进行修改操作。

weixin_44823875的博客 5242

Transformer实战(38)——视觉Transformer (Vision Transformer, ViT)

Transformer 在自然语言处理 (NLP) 领域取得了显著成就,在许多不同的任务中都表现出色。在本节中,我们将探索视觉 Transformer (Vision Transformer, ViT) 模型。正如 NLP 领域创建了多种模型一样,视觉领域也开发了多种模型,每种模型都为计算机视觉提供了新的视角。通过本节,将学习如何使用 ViT 等模型进行计算机视觉任务,了解基于 Transformer 的预训练计算机视觉模型的工作原理,以及如何针对特定任务进行微调。

盼小辉丶的博客 2932

智能硬件产品 App 全球发布 第 1 章:全球 App 发布战略设计

本章阐述智能硬件 App 全球发布战略,涵盖市场分析、竞争格局、用户画像及资源配置。通过制定可执行的全球化推广路径,整合地区法规合规、渠道分发策略与营销活动设计,助力团队快速进入主流商店并确立品牌影响力。同时构建可量化的 KPI 监控体系,指导项目进度追踪与效果复盘,确保产品迭代持续优化,降低运营总成本。

moton2017的博客 157

spring 源码分析

这边通过缓存中的 ObjectFactory 拿到的 bean 实例虽然拿到的是 “不完整” 的bean 实例,但是由于是单例,所以后续初始化完成后,该 bean 实例的引用地址并不会变,所以最终我们看到的还是完整 bean 实例。(2)二级缓存earlySingletonObjects:判断bean是否存在AOP,不存在AOP保存半成品的bean(属性暂未填充),存在AOP保存代理bean的beanProxy(目标bean还是半成品的)refresh() 方法是 Spring 上下文启动的核心方法。

qq_51470789的博客 2187

智能运营模型的建设与运用实践

一项运营活动的全流程,主要包含客群挖掘与筛选、产品与权益选择、触点与活动选择、运营策略调优等关键环节,涉及客群管理、活动管理、权益管理、触达管理、智能调控等系统支撑需求,如今工商银行已开展与其相对应的推荐模型、分析模型等的研发与实践。自2023年9月该模型被知客运营平台吸收并上线以来,已累计有远程银行中心、吉林分行、重庆分行等30余家分行或机构使用,赋能融e借、积存金、结售汇、基金、理财、存款等12种场景,产生营销客户清单达千万人次,有力促进了保守型理财、天天盈、添益快线、寿险等产品的销售。

银行信息系统应用架构详解 851

spring5 源码深度解析-----Spring的整体架构和环境搭建

spring5 源码深度解析-----Spring的整体架构和环境搭建 目录 概述 spring的整体架构 1. Core Container 2. Data Access/Integration 3. Web 4. AOP 5. Test 环境搭建 gradle安装 源码链接获取 源码下载及 IDEA 导入 导入项目遇见问题 创建测试项目 正文 回到顶部 概述 Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向接口的编程思想贯穿整个系统应

m0_58476806的博客 387

【优化模型】求解混合整数线性规划 MILP 问题

混合整数线性规划(Mixed Integer Linear Programming,MILP)是一类优化问题,其中目标函数和约束条件均为线性,并且包含整数变量。MILP 在实际应用中具有广泛的应用,可以解决很多实际问题,如生产调度、网络设计、资源分配等。f — 系数向量。系数向量,指定为实数向量或实数数组。intcon — 整数约束组成的向量。整数约束组成的向量,指定为正整数向量。intcon 中的值指示决策变量 x 中应取整数值的分量。A — 线性不等式约束。线性不等式约束,指定为实矩阵。

Fanjufei的博客 2502

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

spring 5源码深度解析—Spring的整体架构和环境搭建

概述 Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向接口的编程思想贯穿整个系统应用。Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson创建。简单来说,Spring是一个分层的JavaSE/EE full-stack(一站式) 轻量级开源框架。 推荐阅读 为什么阿里的程序员成长如此之快?看完Alibaba“Java成长笔记”我懂了!_马小梦的博客-优快云博客​blog.youkuaiyun.com 推荐观看 大厂面试

小梦爱Java的博客 532

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

spring 源码深度解析_spring 5源码深度解析—Spring的整体架构和环境搭建

概述Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向接口的编程思想贯穿整个系统应用。Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson创建。简单来说,Spring是一个分层的JavaSE/EE full-stack(一站式) 轻量级开源框架。推荐阅读为什么阿里的程序员成长如此之快?看完Alibaba“Jav...

weixin_39723010的博客 99

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

深度学习工具包 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")

asp.net mvc 5高级编程 源码_《Spring源码深度解析—Spring的整体架构和环境搭建》...

概述Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向接口的编程思想贯穿整个系统应用。Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson创建。简单来说,Spring是一个分层的JavaSE/EE full-stack(一站式) 轻量级开源框架。一、spring的整体架构Spring框架是一个分层架构,它包含一...

weixin_39956443的博客 183

java框架源码解读_spring5 源码深度解析-----Spring的整体架构和环境搭建

概述Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向接口的编程思想贯穿整个系统应用。Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson创建。简单来说,Spring是一个分层的JavaSE/EE full-stack(一站式) 轻量级开源框架。spring的整体架构Spring框架是一个分层架构,它包含一系列...

weixin_33936194的博客 221

asp.net mvc 5高级编程 源码_Spring的整体架构和环境搭建(Spring源码深度解析)

概述Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向接口的编程思想贯穿整个系统应用。Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson创建。简单来说,Spring是一个分层的JavaSE/EE full-stack(一站式) 轻量级开源框架。spring的整体架构Spring框架是一个分层架构,它包含一系列...

weixin_39978696的博客 105

spring源码学习 [Day001 / 005]

01Feb.2017 spring源码学习, 计划耗时:五天(From 01Feb.2017 To 05Feb.2017) 主要参考书籍: Spring源码深度解析【人民邮电出版社/郝佳】 MAC OS【10.12.3 (16D32)】 1.下载源代码     git clone git://github.com/SpringSource/Spring-framework.gi

redjava2008的博客 220

Spring源码解析(一):环境搭建

}//创建注解容器,入参为配置类 AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config . class);//获取某个bean Book book = context . getBean(Book . class);//关闭容器 context . close();} }

从基础到源码解析的学习记录 1222

Spring源码深度解析:一、Spring整体架构和源码环境搭建

Spring Core:框架的最基础部分,提供 IoC 容器,对 bean 进行管理。Spring Context:继承BeanFactory,提供上下文信息,扩展出JNDI、EJB、电子邮件、国际化等功能。Spring DAO:提供了JDBC的抽象层,还提供了声明性事务管理方法。Spring ORM:提供了JPA、JDO、Hibernate、MyBatis 等ORM映射层.Spring AOP:集成了所有AOP功能。

知行 3139

Spring5源码解析一

Spring5源码解析 测试用例代码块 //AppConfig.java类 @ComponentScan({"com.llsydn"}) @Configuration public class AppConfig { } //IndexDao.java类 @Component public class IndexDao { public void query(){ System.out.p...

qq_24101357的博客 2万+
上一篇: Protobuf入门
下一篇: Spring5源码解析-Bean的初始化
wflovejava
博客等级 码龄11年 23粉丝 46原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值