<dependencyManagement> <dependencies> <!-- Override Spring Data release train provided by Spring Boot --> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-releasetrain</artifactId> <version>Fowler-SR2</version> <scope>import</scope> <type>pom</type> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>1.5.1.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
项目依赖
起步依赖 spring-boot-starter-xx
Spring Boot提供了很多”开箱即用“的依赖模块,都是以spring-boot-starter-xx作为命名的。举个例子来说明一下这个起步依赖的好处,比如组装台式机和品牌机,自己组装的话需要自己去选择不同的零件,最后还要组装起来,期间有可能会遇到零件不匹配的问题。耗时又消力,而品牌机就好一点,买来就能直接用的,后续想换零件也是可以的。相比较之下,后者带来的效果更好点(这里就不讨论价格问题哈),起步依赖就像这里的品牌机,自动给你封装好了你想要实现的功能的依赖。就比如我们之前要实现web功能,引入了spring-boot-starter-web这个起步依赖。我们来看看spring-boot-starter-web到底依赖了哪些,如下图:
最后
项目启动的三种方式
main方法
使用命令 mvn spring-boot:run在命令行启动该应用,IDEA中该命令在如下位置
运行mvn package进行打包时,会打包成一个可以直接运行的 JAR 文件,使用java -jar命令就可以直接运行
#!/usr/bin/env bash time=$(curl -G -s http://34.0.7.227:9338/traffic/syncDateTime) if [ ! -n "$time" ]; then echo"time is null...." else date -s "${time}" hwclock -w fi
[mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock //设置端口号 port= 3333
#!/bin/sh # chkconfig: 2345 90 10 # description: Redis is a persistent key-value database # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. # 如果redis设置了密码,则$CLIEXEC -a $PASSWORD -p $REDISPORT shutdown 需要加一个参数
case"$1"in start) if [ -f $PIDFILE ] then echo"$PIDFILE exists, process is already running or crashed" else echo"Starting Redis server..." $EXEC$CONF fi ;; stop) if [ ! -f $PIDFILE ] then echo"$PIDFILE does not exist, process is not running" else PID=$(cat$PIDFILE) echo"Stopping ..." $CLIEXEC -a $PASSWORD -p $REDISPORT shutdown while [ -x /proc/${PID} ] do echo"Waiting for Redis to shutdown ..." sleep 1 done echo"Redis stopped" fi ;; *) echo"Please use start or stop as first argument" ;; esac
ftpd_anon_write --> off ftpd_connect_all_unreserved --> off ftpd_connect_db --> off ftpd_full_access --> on ftpd_use_cifs --> off ftpd_use_fusefs --> off ftpd_use_nfs --> off ftpd_use_passive_mode --> off
setsebool -P ftpd_full_access 1 # 设置ftpd_full_access的权限为 on
setenforce 1 # 开启 selinux
这时 selinux 已经开放了 vsftpd 的权限
给 ftp 用户的 home 目录赋予写的权限 chmod a+w /var/ftp
vsftpd 在新版本时,如果检测到用户不能跳出当前的 home 目录,那么用户的 home 不能有写的权限,会报 500 OOPS: vsftpd: refusing to run with writable root inside chroot() 错误,这时就尴尬了
解决方式: 在配置文件中添加: allow_writeable_chroot=YES
重启 vsftpd
无法连接 FTP 服务器
使用 FTP 工具连接失败,报如下错误:
1 2 3 4 5 6 7 8
状态: 连接建立,等待欢迎消息... 状态: 不安全的服务器,不支持 FTP over TLS。 命令: USER ftp 响应: 331 Please specify the password. 命令: PASS ****** 响应: 530 Login incorrect. 错误: 严重错误: 无法连接到服务器 状态: 已从服务器断开
/* - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion. - If you are building a RECURSIVE (caching) DNS server, you need to enable recursion. - If your recursive DNS server has a public IP address, you MUST enable access control to limit queries to your legitimate users. Failing to do so will cause your server to become part of large scale DNS amplification attacks. Implementing BCP38 within your network would greatly reduce such attack surface */ recursion yes;
dnssec-enable yes; dnssec-validation yes;
/* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key";