网站建设资讯

NEWS

网站建设资讯

SpringBoot+SpringSecurity环境怎么搭建-创新互联

这篇文章将为大家详细讲解有关SpringBoot+SpringSecurity环境怎么搭建,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

为阿克陶等地区用户提供了全套网页设计制作服务,及阿克陶网站建设行业解决方案。主营业务为成都做网站、网站建设、阿克陶网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

一、使用SpringBoot+Maven搭建一个多模块项目

SpringBoot+SpringSecurity环境怎么搭建

二、删除父工程的src文件,删除app、browser、core下的.java文件

依赖关系:

  1. demo 依赖 browser

  2. browser、app依赖core

三、父工程pom.xml文件

 
 
  4.0.0 
 
  com.zeke 
  zeke-security 
  0.0.1-SNAPSHOT 
  pom 
  zeke-security 
 
   
    1.0-SNAPSHOT 
   
 
   
    zeke-security-app 
    zeke-security-browser 
    zeke-security-core 
    zeke-security-demo 
   
 
   
     
      junit 
      junit 
      test 
     
     
      org.springframework.boot 
      spring-boot-test 
      1.5.8.RELEASE 
      test 
     
   
 
   
     
       
        io.spring.platform 
        platform-bom 
        Brussels-SR6 
        pom 
        import 
       
       
        org.springframework.cloud 
        spring-cloud-dependencies 
        Dalston.SR5 
        pom 
        import 
       
       
        org.springframework.boot 
        spring-boot-configuration-processor 
        true 
       
     
   
 
   
     
       
        org.apache.maven.plugins 
        maven-compiler-plugin 
        2.3.2 
         
          1.8 
          1.8 
          UTF-8 
         
       
     
   
 

四、zeke-security-demo项目下的pom.xml文件 

 
 
  4.0.0 
 
   
    com.zeke 
    zeke-security 
    0.0.1-SNAPSHOT 
   
 
  zeke-security-demo> 
 
   
     
      com.zeke 
      zeke-security-browser 
      ${zeke-security-version} 
     
     
      junit 
      junit 
      4.12-beta-3 
      test 
     
     
      org.springframework.boot 
      spring-boot-starter-aop 
     
     
      commons-io 
      commons-io 
     
 
     
     
      io.springfox 
      springfox-swagger2 
      2.7.0 
     
     
      io.springfox 
      springfox-swagger-ui 
      2.7.0 
     
 
     
     
      com.github.tomakehurst 
      wiremock 
      2.14.0 
     
     
      org.springframework 
      spring-test 
      4.3.12.RELEASE 
      test 
     
     
      org.springframework 
      spring-test 
      4.3.12.RELEASE 
      test 
     
     
      org.springframework 
      spring-test 
      4.3.12.RELEASE 
      test 
     
   
 
   
     
       
        org.springframework.boot 
        spring-boot-maven-plugin 
        1.5.6.RELEASE 
         
           
             
              repackage 
             
           
         
       
     
    demo 
   

五、zeke-security-core项目下的pom.xml文件 

 
 
  4.0.0 
 
   
    zeke-security 
    com.zeke 
    0.0.1-SNAPSHOT 
   
 
  zeke-security-core 
 
   
     
      org.springframework.cloud 
      spring-cloud-starter-oauth3 
     
     
     
     
     
     
      org.springframework.boot 
      spring-boot-starter-jdbc 
     
     
      mysql 
      mysql-connector-java 
     
     
      org.springframework.social 
      spring-social-config 
     
     
      org.springframework.social 
      spring-social-core 
     
     
      org.springframework.social 
      spring-social-security 
     
     
      org.springframework.social 
      spring-social-web 
     
     
      commons-lang 
      commons-lang 
     
     
      commons-collections 
      commons-collections 
     
     
      commons-beanutils 
      commons-beanutils 
     
   

六、zeke-security-browser项目下的pom.xml文件 

 
 
  4.0.0 
 
   
    com.zeke 
    zeke-security 
    0.0.1-SNAPSHOT 
   
 
  zeke-security-browser 
 
   
     
      com.zeke 
      zeke-security-core 
      ${zeke-security-version} 
     
     
      org.springframework.session 
      spring-session 
     
   

七、zeke-security-app项目下的pom.xml文件 

 
 
  4.0.0 
 
   
    zeke-security 
    com.zeke 
    0.0.1-SNAPSHOT 
   
 
  zeke-security-app 
 
   
     
      com.zeke 
      zeke-security-core 
      ${zeke-security-version} 
     
   

八、zeke-security-demo项目下的application.properties

 spring.datasource.driver-class-name=com.mysql.jdbc.Driver 
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/imooc-demo 
spring.datasource.username=root 
spring.datasource.password= 
 
spring.session.store-type=none 
security.basic.enabled=false

九、在zeke-security-demo启动类上添加测试接口

@RestController 
@SpringBootApplication 
public class ZekeSecurityDemoApplication { 
 
  public static void main(String[] args) { 
    SpringApplication.run(ZekeSecurityDemoApplication.class, args); 
  } 
 
  @GetMapping("/hello") 
  public String hello(){ 
    return "success"; 
  } 
}

十、输入地址localhost/hello

关于“SpringBoot+SpringSecurity环境怎么搭建”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


分享题目:SpringBoot+SpringSecurity环境怎么搭建-创新互联
网站网址:http://cdweb.net/article/piiej.html