1. استخدم Springboot+Maven لإنشاء مشروع متعدد الوحدات (راجع هذه المقالة-> هنا)
2. احذف ملف SRC للمشروع الأصل ، وحذف ملف .java ضمن التطبيق والمستعرض والخوزير
التبعيات:
3.
<؟ XSI: Schemalocation = "http://maven.apache.org/pom/4.0.0 <soph> 0.0.1-snapshot </version> <cplaging> pom </packaging> <ame> zeke-security </name> <frenties> <zeke-security-version> 1.0-snapshot </zeke-security-version-version> </sprenties> <modules> <module> zeke-security-browser </somule> <module> zeke-security-core </somule> <module> zeke-security-demo </suled> </modules> <sependencies> <sperency> <cropeD> junit </groupid> <roupl> org.springframework.boot </groupId> <StifactId> Spring-boot-test </artifactid> <sophy> 1.5.8.Release </version> <scope> اختبار </scope> </reperence> </reperencies> terpendencymagement> <edependencies> <StifactId> منصة BOM </stifactid> <soph> brussels-sr6 </version> <type> pom </type> <scope> استيراد </scope> </sependency> <sependency> <rougiD> org.springframework.cloud </roucopeD> <SpringId> dembendencies </splys> <sperton <type> pom </type> <scope> استيراد </scope> </sependency> <redency> <roupiD> org.springframework.boot </rougiD> <StifactId> spring-boot-configuration-process </expensies </endermanies </expensire> </expensire> </expensire> </epensies </epensies </expensies </expensies> <Groper> org.apache.maven.plugins </rougiD> <StifactId> maven-compiler-plugin </stifactid> <الإصدار> 2.3.2 </version> <sucturation> <source> 1.8 </source> </target> 1.8 </isplist> <conding> utf-8 </charding>
4. ملف pom.xml تحت مشروع Zeke-Security-Demo
<؟ XSI: schemalocation = "http://maven.apache.org/pom/4.0.0 <soph> 0.0.1-snapshot </version> </inpart> <StifactId> zeke-security-demo </stifactid >> <تبعية> <reperency> <roupiD> com.zeke </groupiD> <intifactid> zeke-security-brower </attifactid> <ProupId> Junit </rougeid> <StifactId> Junit </shintifactid> <الإصدار> 4.12-beta-3 </version> <scope> اختبار </scope> </sependency> <reperency> <roucid> org.springframework.boot </groupid> <ProwEd> commons-io </rougiD> <StifactId> commons-io </stifactid> </sependency> <!-Swagger-> <redence> <roupiD> io.springfox </roucid> <StifactId> Springfox-swagger2 </splistid> <roupl> io.springfox </groupiD> <StifactId> springfox-swagger-ui </shintifactid> <الإصدار> 2.7.0 </version> </repreadency> <!-wiremock-> <sedency> <sropencid> com.github.tomakehurst </rougeid> wiremock </reperency> <reperency> <rougiD> org.springframework </rougeid> <StifactId> اختبار الربيع </intifactid> <sophy> 4.3.12.release </version> <sperive> 4.3.12.release </version> <scope> test </scope> </sependency> <reperence> <roupiD> org.springframework </rougeid> <StifactId> اختبار Spring-Test </sult> <splire> <splent> 4.3.12.Release </sold> <roupl> org.springframework.boot </groupId> <StifactId> Spring-boot-maven-plugin </artifactId> <الإصدار> 1.5.6.Release </version> <evelopments> <evelop> <evels> <silege> <NinalName> Demo </initalname> </build> </project>
5. ملف pom.xml تحت مشروع Zeke-Security-Core
<؟ XSI: schemalocation = "http://maven.apache.org/pom/4.0.0 <soph> 0.0.1-snapshot </version> </inpart> <StifactId> zeke-security-core </artifactid> <تبعية> <reperency> <roupl> org.springframework.cloud </rougeid> <stifactid> spring-charter-oauth2 </etrifactid <!-<rougiD> org.springframework.boot </rougiD>-> <!-<StifactId> spring-boot-starter-data-redis </stifactid>-> <!-</dependency>-> <sperence> <StifactId> Spring-boot-starter-Jdbc </shintifactid> </reperency> <reperency> <roupiD> mysql </rougeid> <StifactId> mysql-connector-java </rogeniD> </dependency> <StifactId> Spring-Social-Config </stifactid> </sependency> <reperency> <roupiD> org.springframework.social </rougeid> <StifactId> spring-social-core </stifactid> </pertency> <StifactId> Spring-Security-security </shintifactid> </sependency> <redency> <roupiD> org.springframework.social </groupiD> <StifactId> spring-social-web </shotifactid> </premons <Rependency> <roupiD> Commons-Colles </rougiD> <StifactId> Commons-Collections </ArtifactId> </sependency> <redence> <roupled> commons-beanutils </rougiD> </shintifactid> commons-bynutils </insifactid> </reperenc
6. ملف pom.xml تحت مشروع Zeke-Security-Browser
<؟ XSI: schemalocation = "http://maven.apache.org/pom/4.0.0 <soph> 0.0.1-snapshot </version> </inpart> <StifactId> Zeke-Security-Browster </stifactid> <Eperenceies> <eredency> <roupiD> com.zeke </groupid> <trifactid> zeke-security-core </attifactid> <roupl> org.springframework.session </groupId> <StifactId> ربيع التجمع </insifactid> </perendency> </
7. ملف pom.xml تحت مشروع Zeke-Security-App
<؟ XSI: schemalocation = "http://maven.apache.org/pom/4.0.0 <soph> 0.0.1-snapshot </version> </inpart> <StifactId> zeke-security-app </stifactid> <تبعية> <sependency> <roupiD> com.zeke </rougiD> </insifactid> zeke-security-core </attifactid>
8. التطبيق.
spring.datasource.driver-class-name = com.mysql.jdbc.driver spring.datasource.url = jdbc: mysql: //127.0.0.1: 3306/imooc-demo spring.datasource
9. أضف واجهة الاختبار إلى فئة بدء تشغيل Zeke-Security-Demo
RestControllerSpringBootApplication الفئة العامة ZekesecurityDemoApplication {public static void main (string [] args) {springapplication.run (ZekesecurityDemoapplication.class ، args) ؛ } getMapping ("/hello") السلسلة العامة Hello () {return "success" ؛ }} 10. أدخل العنوان LocalHost/Hello
ما سبق هو كل محتوى هذه المقالة. آمل أن يكون ذلك مفيدًا لتعلم الجميع وآمل أن يدعم الجميع wulin.com أكثر.