Notes on integrating shiro in spring boot 2.0

Spring boot 2.0 fully embraces java8, which greatly simplifies configuration items in security verification. When using shiro, security must be turned off. Security is turned on by default. In the boot1.x version, configuration items can be passed.

security:
  basic:
    enabled: false
management:
  security:
    enabled: false

To disable, but 2.0 due to security and ambiguity, the security-related configuration items are removed, then the integration of shiro has no effect.

By adding an annotation to the main method of startup:

@EnableAutoConfiguration(exclude = {
        org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
})

To prohibit the automatic startup configuration of security to achieve the effect of shiro integration, the specific shiro integration is the same as boot 1.x, please refer to my previous blog post on integrating shiro: https://my.oschina.net/u/3312115/blog/1600830

When spring boot is 2.0, spring is upgraded to above 5.0 by default. Spring mvc's custom scheme for static resource interception: inheritance

WebMvcConfigurerAdapter implements addResourceHandlers is obsolete

, Use inheritance: WebMvcConfigurationSupport to replace, there is one thing to pay special attention to here, that is, WebMvcConfigurationSupport can only be inherited once, and there will be partial failure problems for many times.

My open source project is based on spring boot 2.0 shiro background scaffolding: https://gitee.com/bweird/lenosp 

Demo address: www.lenosp.cn

available for reference

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324123935&siteId=291194637