SpringBoot + SpringSecurity 环境搭建的步骤

网友投稿 280 2023-01-31


SpringBoot + SpringSecurity 环境搭建的步骤

一、使用SpringBoot+Maven搭建一个多模块项目(可以参考这篇文章 --> 这里)

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

依赖关系:

demo 依赖 browser

browser、app依赖core

三、父工程pom.xml文件

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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文件

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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文件

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

zeke-security

com.zeke

0.0.1-SNAPSHOT

zeke-security-core

org.springframework.cloud

spring-cloud-starter-oauth2

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

comhttp://mons-collections

commons-beanutils

commons-beanutils

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

zeke-security

com.zeke

0.0.1-SNAPSHOT

zeke-security-core

org.springframework.cloud

spring-cloud-starter-oauth2

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

comhttp://mons-collections

commons-beanutils

commons-beanutils

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

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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文件

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

zeke-security

com.zeke

0.0.1-SNAPSHOT

zeke-security-app

com.zeke

zeke-security-core

${zeke-security-version}

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:springboot+gradle 构建多模块项目的步骤
下一篇:vue组件name的作用小结
相关文章

 发表评论

暂时没有评论,来抢沙发吧~