赞
踩
本文在csdn不再更新,最新版请到这里:我的笔记
rabbitmq-service.bat start
时一定要以管理员身份进入,不然会被拒绝AccessDenied
错误,检查一下数据库有没有给用户授权并且关联角色ROLE_
开头。SimpleGrantedAuthority auth = new SimpleGrantedAuthority("ROLE_"+roleMapper.findById(role.getRoleId()).getRoleCode());
useradd -m zhangsan
passwd zhangsan
vim /etc/sudoers
(需要先chmod 640 sudoers
,因为该文件本来是只读的)在root ALL=(ALL) ALL
的下一行添加 : zhangsan ALL=(ALL) ALL
(貌似不能在文件末尾添加,会报错)chmod 440 sudoers
/etc/sudoers
文件,系统用不了sudo,root都切换不了了,,解决方法参考这篇:https://blog.csdn.net/caijiapeng0102/article/details/84848473vi ~/.bashrc
,查看该文件里是否有alias ll='ls -l'
这样的数据,如有,将数据前的 “#” 去掉,如果没有,将 alias ll='ls -l'
加进去并保存,然后运行 source ~/.bashrc
命令,即可成功source ~/.bashrc
consul.sh
,内容如下:#!/bin/bash
/usr/local/bin/consul agent -dev
chmod 777 consul.sh
/lib/systemd/system
目录下注册一个服务,配置如下:[Unit] Description=consul service After=network.target After=systemd-user-sessions.service After=network-online.target [Service] User=root Type=simple WorkingDirectory=/root #这个就是脚本所在的目录(实际配置时请删掉注释) ExecStart=/root/consul.sh #这个就是脚本(实际配置时请删掉注释) TimeoutSec=30 Restart=on-failure StartLimitInterval=350 StartLimitBurst=10 [Install] WantedBy=multi-user.target
listen tcp 39.108.107.163:8600: bind: cannot assign requested address
,参考解决办法:https://blog.csdn.net/qq_34707456/article/details/101346509sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
/usr
目录下,而在/usr/bin
目录下su - postgres
,然后执行psql
,如果成功,就表示数据库安装成功了net start 服务名
(可能需要以管理员权限执行)我的xml配置
<service>
<id>rkeService</id>
<name>rke Service</name>
<description>a service</description>
<executable>java</executable>
<arguments>-jar rkeService.jar</arguments>
<startmode>Automatic</startmode>
<logmode>reset</logmode>
<logpath>C:\Users\Lenovo\Desktop\server\logs</logpath>
</service>
其他参考:https://blog.csdn.net/bighuan/article/details/83416390如果已经成功就不用看了
适用于基于spring boot+spring security+jwt的项目
@EnableGlobalMethodSecurity
注解.anyRequest().permitAll()
;@Override protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity .cors()//跨域资源请求开启 .and() .csrf().disable() //不开启跨站请求伪造 .exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint) .accessDeniedHandler(new CustomAccessDeineHandler()) .and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests()//拦截请求,创建FilterSecurityInterceptor,该方法用于配置权限 .antMatchers("/swagger-ui.html").permitAll() .antMatchers("/teacher/login").permitAll() .antMatchers("/visitor/login").permitAll() // .anyRequest().authenticated(); .anyRequest().permitAll(); httpSecurity.addFilterBefore(jwtAuthorizationTokenFilter, UsernamePasswordAuthenticationFilter.class); }
冒号
):参考:
MultipartFile
接收,如果还有其他基本数据类型的参数,建议使用url占位符配合@PathVariable
注解MultipartFile
默认是有限制的,参考:https://kangkang.blog.csdn.net/article/details/54381705接收图片的代码参考:
public String uploadFile(MultipartFile file, String path) { if (file.isEmpty()){ log.error("file is empty"); return null; } String fileName = file.getOriginalFilename(); if (fileName == null || "".equals(fileName.trim())) return null; log.debug("filename: " + fileName); String suffix = fileName.substring(fileName.lastIndexOf(".")); log.debug("suffix: " + suffix); fileName = DateUtil.getTimeStamp() + "_" + fileName; log.debug("filename with timestamp: " + fileName); File imgFile = new File(path + fileName); if (!imgFile.getParentFile().exists()) { if (!imgFile.getParentFile().mkdirs()) { //注意mkdir()和mkdirs()区别 log.error("mkdirs: " + imgFile.getParentFile() + "failed"); return null; } } try { file.transferTo(imgFile);// 文件写入,必须使用绝对路径加文件名,且路径存在 } catch (IOException e) { log.error(e.getMessage()); return null; } return fileName; }
参考文章:
Reject perfectionism
拒绝完美主义Quick debug
(need experience and patience)Pursue simplicity
追求简洁Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。