1. Verwenden Sie Springboot+Maven, um ein Multi-Modul-Projekt zu erstellen (siehe Artikel-> Hier)
2. Löschen Sie die SRC -Datei des übergeordneten Projekts und löschen Sie die .java -Datei unter App, Browser und Kern
Abhängigkeiten:
3. Elternprojekt Pom.xml Datei
<? xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.zeke</groupId> <artifactId>zeke-security</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>zeke-security</name> <properties> <zeke-security-version>1.0-SNAPSHOT</zeke-security-version> </properties> <modules> <module>zeke-security-app</module> <Modul> Zeke-Security-Browser </modul> <modul> Zeke-Security-Core </modul> <modul> Zeke-Security-Demo </modul> </modules> <Deponiers> <abhängigkeit> <gruppe <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-test</artifactId> <version>1.5.8.RELEASE</version> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>io.spring.platform</groupId> <artifactId> Plattform-Bom </artifactId> <version> Brüssel-Sr6 </Version> <Typs> Pom </type> <Scope> Import </scope> </abhängig> <Depopentcy> <gruppe org. <Typ> pom </type> <scope> import </scope> </abhängig> <abhängigkeit> <gruppe> org.springFramework <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build> </project>
4. Die Datei pom.xml unter dem Projekt Zeke-Security-Demo-Projekt
<? XSI: Schemalocation = "http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion> 4.0.0 </modelversion> <element> <uupent> com.ze <artifactId>zeke-security</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>zeke-security-demo</artifactId>> <dependencies> <dependency> <groupId>com.zeke</groupId> <artifactId>zeke-security-browser</artifactId> <version> $ {Zeke-Security-Version} </Version> </abhängig> <depesions> <gruppe> junit </GroupId> <artifactId> junit </artifactId> <version> 4.12-beta-3 </Version> <Scope> test </scope> </abhängig> <abhängigkeit> <gruppe <gruppe <gruppe org. <artifactId>spring-boot-starter-aop</artifactId> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </dependency> <!-- swagger --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version> 2.7.0 </version> </abhängig> <depeaponcy> <gruppe> io.springfox </gruppeId> <artifactId> Springfox-Swagger-ui </artifactId> <version> 2.7.0 </Version> </abhängig> <!-Wiremock-> <EpaptionId> <GroupId> com.github.tomehurst </gruppe-<gruppe <gruppe> com.github.tomehurst </gruppe-gruppe <GroupId> com.github.tomehurst </gruppe-gruppe <gruppe> com.github.tomehurst </gruppe-gruppe <GroupId> com.github.tomehurst </gruppe-gruppen> <gruppe> com. <artifactid> Wiremock </artifactId> <version> 2.14.0 </Version> </abhängig> <depelzie <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.3.12.RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.3.12.RELEASE</version> <Scope> test </scope> </abhängig> </abhängig> <build> <Ponins> <gruppe> org.springFramework.boot </GroupId> <artifactId> Spring-boot-maven-Plugin </artifactid> <Version> 1.5.6.Relase </Version> <executions> <executions> <executions> <xekutionen> <grosss> <xekutionen> <xekutionen> <grosss> <grosss> <executions> <grosss> <executions> <grosss> <executions> <grosss> <executions> <groechte </execution> </executions> </plugin> </plugins> <finanzname> Demo </ledigname> </build> </project> 5. Die Datei pom.xml unter dem Projekt Zeke-Security-Core
<? xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>zeke-security</artifactId> <gruppe> com.zeke </GroupId> <version> 0.0.1-Snapshot </Version> </parent> <artifactId> Zeke-Security-Core </artifactId> <Deichten> <De vorangetrieben> <gruppe-org. <!-<Depopentcy>-> <!-<CrupentID> org.springframework.boot </Groupid>-> <!-<artifactid> Spring-Boot-Starter-Data-redis </artifactid>-> <! <artifactid> Spring-Boot-Starter-Jdbc </artifactId> </abhängig> <depeopentcy> <gruppe> mysql </Groupid> <artifactid> mysql-connector-java </artifactId> </abhängig> <Deponcy> <Gruppenhäuser> org.sc.Socials. <artifactid> Spring-Social-Config </artifactId> </abhängig> <depung> <Groupid> org.springFramework.social </Groupid> <artifactid> Spring-Social-Core </artifactId> </abhängig> <Diefency> <gruppe> org. <artifactId>spring-social-security</artifactId> </dependency> <dependency> <groupId>org.springframework.social</groupId> <artifactId>spring-social-web</artifactId> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> </dependency> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> </dependency> </dependencies> </project>
6. Die Datei pom.xml unter dem Projekt Zeke-Security-Browser
<? XSI: Schemalocation = "http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion> 4.0.0 </modelversion> <element> <uupent> com.ze <artifactId>zeke-security</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>zeke-security-browser</artifactId> <dependencies> <dependency> <groupId>com.zeke</groupId> <artifactId>zeke-security-core</artifactId> <version> $ {Zeke-Security-Version} </Version> </abhängig> <abhängigkeit> <gruppe> org.springFramework.Session </Groupid> <artifactid> Spring-Session </artifactid> </abhängig> </abhängig> </project> </project> 7. Die Datei pom.xml unter der Zeke-Security-App-Projekt
<? xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>zeke-security</artifactId> <gruppe> com.zeke </Groupid> <version> 0.0.1-Snapshot </Version> </parent> <artifactid> zeke-security-App </artifactid> <depeopcies> <Depopentcy> <gruppeId> com.zeke </gruppen> <artifactid> zeke-security-core </artifactid> </artifactid> </artifactid> <version> $ {Zeke-Security-Version} </Version> </abhängig> </project> 8. Anwendung.Properties im Rahmen des Projekts Zeke-Security-Demo
Spring.DataSource.Driver-Klasse-name = com.mysql.jdbc.driver Spring.datasource.url = Jdbc: mysql: //127.0.0.1: 3306/Imooc-Demo Spring.datasource.username = Wurzel Spring.DataSource.Password = Password = Password = Password = Security.basic.Enabled = false
9. Testschnittstelle zur Zeke-Security-Demo-Startkurs hinzufügen
@RestController @springbootApplication Public Class ZekeSecurityDemoApplication {public static void main (String [] args) {Springapplication.run (ZekeSecurityDemoApplication.CLASS, Args); } @GetMapping ("/hello") public String hello () {return "Erfolg"; }} 10. Geben Sie die Adresse localhost/Hallo ein
Das obige ist der gesamte Inhalt dieses Artikels. Ich hoffe, es wird für das Lernen aller hilfreich sein und ich hoffe, jeder wird Wulin.com mehr unterstützen.