boot

Spring Boot 全局异常捕捉,自定义异常并统一返回

匿名 (未验证) 提交于 2019-12-02 23:43:01
下面代码可直接拷在项目内运行即可,MessageResult类为一个统一返回类 /** * 自定义异常处理器 * * @author 问梦杀帝 * */ @RestControllerAdvice public class ExceptionController { private static final Logger log = LoggerFactory.getLogger(ExceptionController.class); MessageResult<String> result = new MessageResult<String>(); /** * 请求方式不支持 */ @ExceptionHandler({ HttpRequestMethodNotSupportedException.class }) public MessageResult<String> handleException(HttpRequestMethodNotSupportedException e) { log.error(e.getMessage(), e); result.setResultCode(500); result.setResultMessage("不支持' " + e.getMethod() + "'请求"); return result; } /** *

ubuntu16.04安装nvidia驱动

匿名 (未验证) 提交于 2019-12-02 23:43:01
1、bios中务必关闭Secure Boot: ps:如果在bios中Secure Boot是灰色的,无法disable,请往下看: 关于Secure Boot在bios中有一段话解释: Secure Boot be enabled only when: (1).Platform Key(PK) is enrolled and platform is operating in User mode; (2). CSM function is disabled in setup。 因此,要Disable Secure Boot,首先如果PK(也就是bios中Key Managemnet有key,请全部 delete),其次Boot选项中,Launch CSM请设置为Disable。 2、(没有这一步nvidia-smi会显示未找到命令) sudo apt update sudo apt dist-upgrade sudo reboot 3、在系统设置-软件和更新-附加驱动中选择要安装的驱动-应用更改 4、重启 5、 nvidia-smi 显示如下则安装成功 参考: https://blog.csdn.net/qq_20492405/article/details/79034430 https://blog.csdn.net/zhicheng_angle/article/details

Spring Boot 快速入门

匿名 (未验证) 提交于 2019-12-02 23:41:02
引自官网的一段话,大概是说: Spring Boot 是所有基于 Spring 开发的项目的起点。Spring Boot 的设计是为了让你尽可能快的跑起来 Spring 应用程序并且尽可能减少你的配置文件。 它使用 “习惯优于配置” (项目中存在大量的配置,此外还内置一个习惯性的配置,让你无须)的理念让你的项目快速运行起来。 它并不是什么新的框架,而是默认配置了很多框架的使用方式,就像 Maven 整合了所有的 jar 包一样,Spring Boot 整合了所有框架(引自: springboot(一):入门篇――纯洁的微笑 ) 回顾我们之前的 SSM 项目,搭建过程还是比较繁琐的,需要: 1)配置 web.xml,加载 spring 和 spring mvc 2)配置数据库连接、配置日志文件 3)配置家在配置文件的读取,开启注解 4)配置mapper文件 ..... 配置完成之后部署 Tomcat 调试 ..... 现在非常流行微服务,如果一个项目仅仅只是需要发送一个邮件,如果这个项目仅仅是生产一个积分;我都需要这样折腾一遍! 并且利用 IDEA 可以自动生成生成,这简直是太爽了 划重点:简单、快速、方便地搭建项目;对主流开发框架的无配置集成;极大提高了开发、部署效率。 优秀博客地址: https://www.cnblogs.com/wmyskxz/p/9010832.html

Raspberry-config

匿名 (未验证) 提交于 2019-12-02 23:41:02
Raspberry-config 关于树莓派安装、配置、使用等的技巧、工具 https://github.com/yaoqs/Raspberry-config 目录及说明 boot 参见boot目录下 README.md 将boot目录下文件放在/boot目录下 cmdline.txt 文件为系统初始化配置参数,根据需要修改相关参数,可在开头添加ip=192.168.173.1 来设置eth0以太网静态地址 config.txt 文件为树莓派参数配置文件,可根据需要修改相关参数,使其适配主板电流、显示器等 config_raw.txt 文件为备份的原始树莓派参数配置文件 softwaresrc.sh 文件为shell脚本,用于自动修改软件更新源,可自定义 在/boot目录下 cd /boot chmod +x ./softwaresrc.sh sudo ./softwaresrc.sh ssh 文件可使树莓派默认打开ssh功能,由于新版本中树莓派系统默认禁用了 SSH 服务,因此在/boot目录下添加此文本可使树莓派默认打开ssh功能 As of the November 2016 release, Raspbian has the SSH server disabled by default. 出错的详细信息为: ssh: connect to host 192.168.43

centos 升级内核方法

匿名 (未验证) 提交于 2019-12-02 23:40:02
rpm安装包可以通过这个网站下载: 这个是CentOS6 x64 : http://elrepo.org/linux/kernel/el6/x86_64/RPMS/ 这个是CentOS7 x64 : http://elrepo.org/linux/kernel/el7/x86_64/RPMS/ RPM-GPG-KEY-elrepo.org : https://www.elrepo.org/RPM-GPG-KEY-elrepo.org Kernel-lt是长期维护版一般选这个,Kernel-ml是Linus亲自维护的主分支版本 下载所需的内核版本 yum install kernel - lt - 4.4 . 103 - 1.el7.elrepo . x86_64 . rpm - y #yum安装内核包 #如果没有外网先安装key,下载地址:https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -- import RPM - GPG - KEY - elrepo . org rpm - ivh kernel - lt - 4.4 . 103 - 1.el7.elrepo . x86_64 . rpm - y #设置默认启动项,0是按menuentry顺序。比如要默认从第四个菜单项启动,数字改为3,若改为 saved,则默认为上次启动项。

spring boot双数据源

匿名 (未验证) 提交于 2019-12-02 23:39:01
1、创建数据源配置文件DataSourceConfig @Configuration public class DataSourceConfig { @Primary @Bean(name = "primaryDataSourceProperties") @Qualifier("primaryDataSourceProperties") @ConfigurationProperties(prefix="spring.datasource.Primary") public DataSourceProperties primaryDataSourceProperties() { return new DataSourceProperties(); } @Primary @Bean(name = "primaryDataSource") @Qualifier("primaryDataSource") @ConfigurationProperties(prefix="spring.datasource.Primary") public DataSource primaryDataSource(@Qualifier("primaryDataSourceProperties") DataSourceProperties primaryDataSourceProperties) { return

SCCM学习笔记 Day 3.txt

匿名 (未验证) 提交于 2019-12-02 23:38:02
Module 8 (续) Windows Patch推送 1.WSUS有一张"补丁清单"(WSUS DB) ↑ ↓ 配置Role 同步清单(overwrite) ↑ ↓ SUP(Role)有一张"补丁清单"(SCCM DB) 同步可以设置自动同步计划 2.勾选对应清单中OS,可以使WSUS下载补丁清单(仅清单,非补丁安装包) 3.Client上的Configuration Manager-->软件更新扫描周期-->用来扫描Client上已安装的补丁。 4.补丁--(隶属于)-->软件更新组-->“下载”部署包-->推送到DP-->从“软件更新组”Deploy到Agent。 Module 9 Implement Endpoint Protection 微软官方的杀毒软件,没啥可以记录的 Module 10 Compliance and Secure Data Access 1.合规性检查的设置,不仅可以检查,同时也具备修正Regedit,修复Client上RDP设置的可选项。 2.配置合规性检查的步骤 Configuration Items-->Baseline-->与Client进行比对-->Report生成 3.Client Settings-->Default Client Settings-->Compliance Settings里可以配置Configuration

spring boot 接口返回值封装

匿名 (未验证) 提交于 2019-12-02 23:38:02
版权声明:版权所有,未经许可,禁止转载! https://blog.csdn.net/weixin_43031412/article/details/90763012 Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 spring boot 连接Mysql spring boot配置druid连接池连接mysql spring boot集成mybatis(1) spring boot 接口返回值封装 spring boot输入数据校验(validation) spring boot 异常(exception)处理 spring boot 环境配置(profile)切换 spring boot redis 缓存(cache)集成 概述 rest接口会返回各种各样的数据,如果对接口的格式不加约束,很容易造成混乱。 在实际项目中,一般会把结果放在一个封装类中,封装类中包含http状态值,状态消息,以及实际的数据。 本篇实现一个结果的封装类。 封装类代码 Result.java public class Result implements Serializable { @SuppressWarnings ( "unused" ) private

springboot源码分析

匿名 (未验证) 提交于 2019-12-02 23:36:01
/** *SpringApplication */ //构造器初始化 public SpringApplication(ResourceLoader resourceLoader, Class... primarySources) { this.sources = new LinkedHashSet(); //横幅模式 OFF,CONSOLE,LOG; this.bannerMode = Mode.CONSOLE; this.logStartupInfo = true; this.addCommandLineProperties = true; this.addConversionService = true; this.headless = true; this.registerShutdownHook = true; this.additionalProfiles = new HashSet(); this.isCustomEnvironment = false; this.resourceLoader = resourceLoader; Assert.notNull(primarySources, "PrimarySources must not be null"); this.primarySources = new LinkedHashSet(Arrays.asList