Giter Site home page Giter Site logo

fish's Introduction



简介

Fish 是一个使用 Spring Boot + Spring Security + JWT 开发的基于 RBAC 权限控制的快速启动器。

前端

前端项目为 d2-admin-fish

home user role permission menu

使用

缓存使用了 Redis,因此需要先启动一个 Redis Server 服务,然后再启动主程序。

  • 打包
$ mvn clean package
  • 启动
$ cd target && java -jar fish-0.0.1-SNAPSHOT.jar

Docker

  • 构建镜像

需要注意的是,构建使用了多阶段构建。在第一个阶段使用了非官方的 Maven Image(它是在官方镜像的基础上修改了 Maven 的配置文件,加入了阿里云 Mirror 来加速构建过程)编译项目,因此需要先在服务器上构建该 Maven 镜像。

$ docker build --build-arg VERSION=0.0.1.RELEASE --no-cache -t nekolr/fish:0.0.1 .
  • 运行容器
$ docker run --env VERSION=0.0.1.RELEASE \
    --name fish -dit \
    --network=host \
    nekolr/fish:0.0.1

fish's People

Contributors

nekolr avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

lidachun

fish's Issues

Docker build issues

在构建 Docker 镜像的过程中需要通过 mvn clean package 进行项目编译,这个过程会执行项目的测试代码,尝试连接数据库,而此时 maven image 中并没有安装并运行数据库软件(MySQL)。

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.nekolr.fish.entity.User.roles, could not initialize proxy - no Session

User user = userService.findByUsername(username);

复现过程:
登录 -> 创建用户 -> 删除刚创建的用户时会报错:org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.nekolr.fish.entity.User.roles, could not initialize proxy - no Session

@Cacheable will affect the lazy loading mechanism of @ManyToMany

User user = userService.findByUsername(username);

在这段代码中,当 User 的信息是通过缓存而不是查询数据库所得时,user 的 roles 属性因为是懒加载的,所以有可能会触发查询数据库的操作,而此时 hibernate session 根本就没有初始化,所以会报错:org.hibernate.LazyInitializationException: failed to lazily initialize a collection, could not initialize proxy - no Session

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.