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. 修改Host,配置域名访问

    修改Host,配置域名访问   虽然我们已经能够通过localhost访问本地网站了,为了提高逼格,我们可以修改host文件,设置一个自己喜欢的域名指向本地网站,岂不是更高大上. 明确需求 通过配置, ...

  2. windows上dubbo-admin的安装

    dubbo-admin的安装 (1)先下载好zookeeper包,因为启动dubbo-admin时需要先启动zookeeper zookeeper:dubbo的注册中心(自己下载 ,找到bin目录下的 ...

  3. 【转载】《Learn More Study Less》整体性学习方法

    原文 忘记在哪里看到这本书的介绍了,据说是一个小子自学1年,完成了4年麻省理工的课程,然后写了一本他学习方法的书.我搜了一下,居然中英文版都有,就花时间好好读了一遍,就是这本. 以下是这本书的完整笔记 ...

  4. swiftlint 你所要知道的所有!!

    swiftin Should the opening brace of a function or control flow statement be on a new line or not ?:) ...

  5. python中的各种模块(np,os,shutill)

    PS:本博文摘抄自中国慕课大学上的课程<Python数据分析与展示>,推荐刚入门的同学去学习,这是非常好的入门视频. #np模块 .ndim :维度 .shape :各维度的尺度 (2,5 ...

  6. SQL-19 查找所有员工的last_name和first_name以及对应的dept_name,也包括暂时没有分配部门的员工

    题目描述 查找所有员工的last_name和first_name以及对应的dept_name,也包括暂时没有分配部门的员工CREATE TABLE `departments` (`dept_no` c ...

  7. Centos7部署open-falcon 0.2

    参考: https://www.cnblogs.com/straycats/p/7199209.html http://book.open-falcon.org/zh_0_2/quick_instal ...

  8. 自动化创建tornado项目

    tornado目录结构: index.py 入口文件 app app目录 |___ __init__.py 初始化脚本 |___ templates  模板目录 |        |___ index ...

  9. jquery元素插入、删除、清空、找父子级元素

    1)jquery元素插入 <!--位置1--> <div id='test'> <!--位置2--> <div>测试</div> <! ...

  10. POJ - 2823 Sliding Window (滑动窗口入门)

    An array of size n ≤ 10 6 is given to you. There is a sliding window of size kwhich is moving from t ...