1.springboot生成项目

PS : 进入项目,输入gradle build,生成build文件夹;  然后进入libs有jar,使用java jar进行运行项目

PS: 这个项目没有准守restful APi

PS: 顺序扫描效率不高

全文搜索就是把无规则的再次组织形成有规律数据,再进行创建索引。

PS: 非常类似于查字典,可以按照顺序一个一个找,也可以按照拼音找

------------------------------------------------------------------------

搜索引擎选择: Elasticsearch与Solr, 目前es会更火爆

PS:索引可以划分成 多个分片(因为索引的数据量太大,所以继续划分), 一个分片又可以划分成多个副本

PS: 近实时, 就是添加一个东西以后,不会立马刷入磁盘,等个几s才能查的到

PS: 类型,对索引进行分类

PS: 文档是进行索引的基本单位,每个索引都有一个文档与之对应

-------------------------------------------------------------------------------------------------------------------

PS : 安装启动es

PS:  和jpa类似 会根据名字查询

PS : 这个normalize用来解决跨浏览器的一致性

-----------------------------------

PS: 现在测试一个只根据    超小屏幕  和 中屏幕 开发的项目

PS: 这是中屏幕的效果

------------------------实战后台

package com.waylau.spring.boot.blog.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder; /**
* Spring Security 配置类.
*
* @since 1.0.0 2017年3月8日
* @author <a href="https://waylau.com">Way Lau</a>
*/
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true) // 启用方法安全设置
public class SecurityConfig extends WebSecurityConfigurerAdapter { private static final String KEY = "waylau.com"; @Autowired
private UserDetailsService userDetailsService; @Autowired
private PasswordEncoder passwordEncoder; @Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder(); // 使用 BCrypt 加密
} @Bean
public AuthenticationProvider authenticationProvider() {
DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider();
authenticationProvider.setUserDetailsService(userDetailsService);
authenticationProvider.setPasswordEncoder(passwordEncoder); // 设置密码加密方式
return authenticationProvider;
} /**
* 自定义配置, !!!!必须重写这个方法
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/css/**", "/js/**", "/fonts/**", "/index").permitAll() // 都可以访问
.antMatchers("/h2-console/**").permitAll() // 都可以访问
.antMatchers("/admins/**").hasRole("ADMIN") // 需要相应的角色才能访问, 只有admin才能访问/admins/**
.and()
.formLogin() //基于 Form 表单登录验证
.loginPage("/login").failureUrl("/login-error") // 自定义登录界面
.and().rememberMe().key(KEY) // 启用 remember me
.and().exceptionHandling().accessDeniedPage("/403"); // 处理异常,拒绝访问就重定向到 403 页面
http.csrf().ignoringAntMatchers("/h2-console/**"); // 禁用 H2 控制台的 CSRF 防护
http.headers().frameOptions().sameOrigin(); // 允许来自同一来源的H2 控制台的请求
} /**
* 认证信息管理
* @param auth
* @throws Exception
*/
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService);
auth.authenticationProvider(authenticationProvider());
}
}
package com.waylau.spring.boot.blog.controller;

import java.util.ArrayList;
import java.util.List; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import com.waylau.spring.boot.blog.domain.Authority;
import com.waylau.spring.boot.blog.domain.User;
import com.waylau.spring.boot.blog.service.AuthorityService;
import com.waylau.spring.boot.blog.service.UserService; /**
* 主页控制器.
*
* @since 1.0.0 2017年3月8日
* @author <a href="https://waylau.com">Way Lau</a>
*/
@Controller
public class MainController { private static final Long ROLE_USER_AUTHORITY_ID = 2L; @Autowired
private UserService userService; @Autowired
private AuthorityService authorityService; @GetMapping("/")
public String root() {
return "redirect:/index";
} @GetMapping("/index")
public String index() {
return "redirect:/blogs";
} /**
* 获取登录界面
* @return
*/
@GetMapping("/login")
public String login() {
return "login";
} @GetMapping("/login-error")
public String loginError(Model model) {
model.addAttribute("loginError", true);
model.addAttribute("errorMsg", "登陆失败,账号或者密码错误!");
return "login";
} @GetMapping("/register")
public String register() {
return "register";
} /**
* 注册用户
* @param user
* @param result
* @param redirect
* @return
*/
@PostMapping("/register")
public String registerUser(User user) {
List<Authority> authorities = new ArrayList<>();
authorities.add(authorityService.getAuthorityById(ROLE_USER_AUTHORITY_ID));
user.setAuthorities(authorities);
userService.saveUser(user);
return "redirect:/login";
} @GetMapping("/search")
public String search() {
return "search";
}
}

--------------------------前台

SpringBoot企业级博客开发的更多相关文章

  1. 使用Docker部署Spring-Boot+Vue博客系统

    在今年年初的时候,完成了自己的个Fame博客系统的实现,当时也做了一篇博文Spring-boot+Vue = Fame 写blog的一次小结作为记录和介绍.从完成实现到现在,也断断续续的根据实际的使用 ...

  2. Padrino 博客开发示例

    英文版出处:http://www.padrinorb.com/guides/blog-tutorial 楼主按 拿作者自己的话说:Padrino(谐音:派骓诺)是一款基于Sinatra的优雅的Web应 ...

  3. Django博客开发实践,初学者开发经验

    python,Django初学者,开发简易博客,做了一下笔记,记录了开发的过程,功力浅薄,仅供初学者互相 交流,欢迎意见建议.具体链接:Django博客开发实践(一)--分析需求并创建项目 地址:ht ...

  4. Django个人博客开发 | 前言

    本渣渣不专注技术,只专注使用技术,不是一个资深的coder,是一个不折不扣的copier 1.前言 自学 Python,始于 Django 框架,Scrapy 框架,elasticsearch搜索引擎 ...

  5. Django 博客开发教程目录索引

    Django 博客开发教程目录索引 本项目适合 0 基础的 Django 开发新人. 项目演示地址:Black & White,代码 GitHub 仓库地址:zmrenwu/django-bl ...

  6. django 简易博客开发 5 markdown支持、代码高亮、gravatar头像服务

    上一篇博客介绍了comments库使用及ajax支持,现在blog已经具备了基本的功能,但是只能发表文字,不支持富文本编辑.今天我们利用markdown添加富文本支持. markdown语法说明: h ...

  7. django 简易博客开发 4 comments库使用及ajax支持

    首先还是贴一下源代码地址  https://github.com/goodspeedcheng/sblog 上一篇文章我们介绍了静态文件使用以及如何使用from实现对blog的增删改,这篇将介绍如何给 ...

  8. django 简易博客开发 3 静态文件、from 应用与自定义

    首先还是贴一下源代码地址  https://github.com/goodspeedcheng/sblog 上一篇博客我们介绍了 django 如何在views中使用templates以及一些常用的数 ...

  9. django 简易博客开发 2 模板和数据查询

    首先还是贴一下项目地址  https://github.com/goodspeedcheng/sblog   因为代码全在上面 上一篇博客我们介绍了 django的安装配置,新建project,新建a ...

随机推荐

  1. mysql插入中文乱码

    https://www.cnblogs.com/zhchoutai/p/7364835.html 最简单的一招,不用修改my.ini文件: 1.停掉mysql服务 2.启动:X:\%path%\MyS ...

  2. day31 锁 队列 前面课程重点总结

    今日内容: 1.进程的其他方法 2.僵尸进程和孤儿进程(了解) 3.验证进程之间是空间隔离的 4.守护进程 5.进程锁 重点(又叫同步锁,互斥锁) 6.进程队列(重点)  Queue 7.生产者消费者 ...

  3. 卷积与反卷积以及步长stride

    1. 卷积与反卷积 如上图演示了卷积核反卷积的过程,定义输入矩阵为 I(4×4),卷积核为 K(3×3),输出矩阵为 O(2×2): 卷积的过程为:Conv(I,W)=O 反卷积的过称为:Deconv ...

  4. Xcode清理存储空间

    文章来自 枣泥布丁 http://www.cocoachina.com/ios/20170711/19814.html 请针对性的选择删除 移除 Xcode 运行安装 APP 产生的缓存文件(Deri ...

  5. 查看linux 内核版本信息

    uname -r2.6.32-696.el6.x86_64uname -ix86_64

  6. matla互相关协方差的计算和理解

    计算相关函数和协方差的MATLAB函数 MATLAB信号处理工具箱提供了计算随机信号相关函数xcorr. 函数xcorr用于计算随机序列自相关和互相关函数.调用格式为: [c,lags]=xcorr( ...

  7. MySQL:MySQL Workbench的使用

    MySQL Workbench 一.布局介绍 附:图片转自https://blog.csdn.net/qq_19891827/article/details/53995079 二.创建数据库 第一步: ...

  8. ubantu清理垃圾文件操作

    安装的ubuntu 18.01 , 随着使用的时间变长,陆陆续续使用了不少的软件, 更新了不少的软件包. 导致了现在ubuntu 系统反应速度严重下降. 下面是几种清理linux系统下冗余垃圾的命令, ...

  9. 【Python】多线程-1

    #练习:创建一个线程 from threading import Thread import time def run(a = None, b = None) : print a, b time.sl ...

  10. SQL注入之Sqli-labs系列第十一关(基于单引号的万能密码注入)

    本来以前写过sqli-labs的实战文章,但由于搞了事情,自己的服务器IP被封了,到期后又不太想续了,就一直没管.心酸的痛,都懂的....... 好了,最近这两天一口气写完前十关GET型的,现在到了P ...