一、使用SpringBoot+Maven搭建一个多模块项目(可以参考这篇文章 --> 这里)
二、删除父工程的src文件,删除app、browser、core下的.java文件
依赖关系:
- demo 依赖 browser
- browser、app依赖core
三、父工程pom.xml文件
4.0.0 com.zeke zeke-security0.0.1-SNAPSHOT pom zeke-security 1.0-SNAPSHOT zeke-security-app zeke-security-browser zeke-security-core zeke-security-demo junit junittest org.springframework.boot spring-boot-test1.5.8.RELEASE test io.spring.platform platform-bomBrussels-SR6 pom import org.springframework.cloud spring-cloud-dependenciesDalston.SR5 pom import org.springframework.boot spring-boot-configuration-processortrue org.apache.maven.plugins maven-compiler-plugin2.3.2 1.8 1.8 UTF-8
四、zeke-security-demo项目下的pom.xml文件
4.0.0 zeke-security-demo> com.zeke zeke-security0.0.1-SNAPSHOT com.zeke zeke-security-browser${zeke-security-version} junit junit4.12-beta-3 test org.springframework.boot spring-boot-starter-aopcommons-io commons-ioio.springfox springfox-swagger22.7.0 io.springfox springfox-swagger-ui2.7.0 com.github.tomakehurst wiremock2.14.0 org.springframework spring-test4.3.12.RELEASE test org.springframework spring-test4.3.12.RELEASE test org.springframework spring-test4.3.12.RELEASE test org.springframework.boot spring-boot-maven-plugin1.5.6.RELEASE repackage demo
五、zeke-security-core项目下的pom.xml文件
4.0.0 zeke-security zeke-security-corecom.zeke 0.0.1-SNAPSHOT org.springframework.cloud spring-cloud-starter-oauth2org.springframework.boot spring-boot-starter-jdbcmysql mysql-connector-javaorg.springframework.social spring-social-configorg.springframework.social spring-social-coreorg.springframework.social spring-social-securityorg.springframework.social spring-social-webcommons-lang commons-langcommons-collections commons-collectionscommons-beanutils commons-beanutils
六、zeke-security-browser项目下的pom.xml文件
4.0.0 zeke-security-browser com.zeke zeke-security0.0.1-SNAPSHOT com.zeke zeke-security-core${zeke-security-version} org.springframework.session spring-session
七、zeke-security-app项目下的pom.xml文件
4.0.0 zeke-security zeke-security-appcom.zeke 0.0.1-SNAPSHOT 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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



