Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
灰非灰乀
spring-boot-examples
提交
b8543683
S
spring-boot-examples
项目概览
灰非灰乀
/
spring-boot-examples
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-boot-examples
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b8543683
编写于
3月 18, 2019
作者:
微笑很纯洁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update version to 2.10
上级
ed67c898
变更
74
展开全部
隐藏空白更改
内联
并排
Showing
74 changed file
with
7457 addition
and
283 deletion
+7457
-283
spring-boot-jpa-thymeleaf-curd/pom.xml
spring-boot-jpa-thymeleaf-curd/pom.xml
+1
-1
spring-boot-jpa-thymeleaf-curd/spring-boot-jpa-thymeleaf-curd.iml
...oot-jpa-thymeleaf-curd/spring-boot-jpa-thymeleaf-curd.iml
+85
-0
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/JpaThymeleafApplication.java
...f-curd/src/main/java/com/neo/JpaThymeleafApplication.java
+1
-1
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/model/User.java
...-jpa-thymeleaf-curd/src/main/java/com/neo/model/User.java
+1
-1
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/repository/UserRepository.java
...curd/src/main/java/com/neo/repository/UserRepository.java
+2
-2
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/service/UserService.java
...eleaf-curd/src/main/java/com/neo/service/UserService.java
+1
-1
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/service/impl/UserServiceImpl.java
...d/src/main/java/com/neo/service/impl/UserServiceImpl.java
+2
-3
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/web/UserController.java
...meleaf-curd/src/main/java/com/neo/web/UserController.java
+1
-3
spring-boot-jpa-thymeleaf-curd/src/main/resources/application.properties
...-thymeleaf-curd/src/main/resources/application.properties
+1
-1
spring-boot-jpa-thymeleaf-curd/target/classes/application.properties
...-jpa-thymeleaf-curd/target/classes/application.properties
+10
-0
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/JpaThymeleafApplication.class
...curd/target/classes/com/neo/JpaThymeleafApplication.class
+0
-0
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/model/User.class
...pa-thymeleaf-curd/target/classes/com/neo/model/User.class
+0
-0
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/repository/UserRepository.class
...rd/target/classes/com/neo/repository/UserRepository.class
+0
-0
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/service/UserService.class
...eaf-curd/target/classes/com/neo/service/UserService.class
+0
-0
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/service/impl/UserServiceImpl.class
...target/classes/com/neo/service/impl/UserServiceImpl.class
+0
-0
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/web/HelloController.class
...eaf-curd/target/classes/com/neo/web/HelloController.class
+0
-0
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/web/UserController.class
...leaf-curd/target/classes/com/neo/web/UserController.class
+0
-0
spring-boot-jpa-thymeleaf-curd/target/classes/static/css/bootstrap.css
...pa-thymeleaf-curd/target/classes/static/css/bootstrap.css
+6760
-0
spring-boot-jpa-thymeleaf-curd/target/classes/templates/hello.html
...ot-jpa-thymeleaf-curd/target/classes/templates/hello.html
+10
-0
spring-boot-jpa-thymeleaf-curd/target/classes/templates/user/list.html
...pa-thymeleaf-curd/target/classes/templates/user/list.html
+43
-0
spring-boot-jpa-thymeleaf-curd/target/classes/templates/user/userAdd.html
...thymeleaf-curd/target/classes/templates/user/userAdd.html
+43
-0
spring-boot-jpa-thymeleaf-curd/target/classes/templates/user/userEdit.html
...hymeleaf-curd/target/classes/templates/user/userEdit.html
+44
-0
spring-boot-mail/pom.xml
spring-boot-mail/pom.xml
+6
-15
spring-boot-mail/src/main/java/com/neo/MailApplication.java
spring-boot-mail/src/main/java/com/neo/MailApplication.java
+2
-2
spring-boot-mail/src/test/java/com/neo/MailApplicationTests.java
...boot-mail/src/test/java/com/neo/MailApplicationTests.java
+1
-1
spring-boot-mongodb/spring-boot-mongodb/pom.xml
spring-boot-mongodb/spring-boot-mongodb/pom.xml
+3
-15
spring-boot-mongodb/spring-boot-mongodb/src/main/java/com/neo/MongoDBApplication.java
...oot-mongodb/src/main/java/com/neo/MongoDBApplication.java
+2
-3
spring-boot-mongodb/spring-boot-mongodb/src/main/java/com/neo/model/User.java
...spring-boot-mongodb/src/main/java/com/neo/model/User.java
+2
-2
spring-boot-mongodb/spring-boot-mongodb/src/main/java/com/neo/repository/UserRepository.java
...godb/src/main/java/com/neo/repository/UserRepository.java
+18
-0
spring-boot-mongodb/spring-boot-mongodb/src/main/java/com/neo/repository/impl/UserRepositoryImpl.java
...main/java/com/neo/repository/impl/UserRepositoryImpl.java
+12
-13
spring-boot-mongodb/spring-boot-mongodb/src/main/resources/application.properties
...ng-boot-mongodb/src/main/resources/application.properties
+5
-0
spring-boot-mongodb/spring-boot-mongodb/src/test/java/com/neo/MongoDBApplicationTests.java
...ongodb/src/test/java/com/neo/MongoDBApplicationTests.java
+1
-1
spring-boot-mongodb/spring-boot-mongodb/src/test/java/com/neo/repository/UserRepositoryTest.java
.../src/test/java/com/neo/repository/UserRepositoryTest.java
+7
-7
spring-boot-mongodb/spring-boot-multi-mongodb/pom.xml
spring-boot-mongodb/spring-boot-multi-mongodb/pom.xml
+1
-15
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/MultiMongodbApplication.java
...ongodb/src/main/java/com/neo/MultiMongodbApplication.java
+2
-3
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/config/MultipleMongoConfig.java
...odb/src/main/java/com/neo/config/MultipleMongoConfig.java
+9
-11
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/config/PrimaryMongoConfig.java
...godb/src/main/java/com/neo/config/PrimaryMongoConfig.java
+23
-0
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/config/SecondaryMongoConfig.java
...db/src/main/java/com/neo/config/SecondaryMongoConfig.java
+24
-0
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/config/props/MultipleMongoProperties.java
...in/java/com/neo/config/props/MultipleMongoProperties.java
+16
-5
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/model/User.java
...-boot-multi-mongodb/src/main/java/com/neo/model/User.java
+49
-0
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/repository/primary/PrimaryRepository.java
...in/java/com/neo/repository/primary/PrimaryRepository.java
+10
-0
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/repository/secondary/SecondaryRepository.java
...ava/com/neo/repository/secondary/SecondaryRepository.java
+10
-0
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/resources/application.properties
...t-multi-mongodb/src/main/resources/application.properties
+8
-0
spring-boot-mongodb/spring-boot-multi-mongodb/src/test/java/com/neo/MultiMongodbApplicationTests.java
...b/src/test/java/com/neo/MultiMongodbApplicationTests.java
+1
-1
spring-boot-mongodb/spring-boot-multi-mongodb/src/test/java/com/neo/repository/MuliDatabaseTest.java
...db/src/test/java/com/neo/repository/MuliDatabaseTest.java
+11
-23
spring-boot-mongodb/src/main/java/com/neo/dao/UserDao.java
spring-boot-mongodb/src/main/java/com/neo/dao/UserDao.java
+0
-18
spring-boot-mongodb/src/main/resources/application.properties
...ng-boot-mongodb/src/main/resources/application.properties
+0
-5
spring-boot-multi-mongodb/src/main/java/com/neo/Application.java
...boot-multi-mongodb/src/main/java/com/neo/Application.java
+0
-18
spring-boot-multi-mongodb/src/main/java/com/neo/config/PrimaryMongoConfig.java
...godb/src/main/java/com/neo/config/PrimaryMongoConfig.java
+0
-15
spring-boot-multi-mongodb/src/main/java/com/neo/config/SecondaryMongoConfig.java
...db/src/main/java/com/neo/config/SecondaryMongoConfig.java
+0
-15
spring-boot-multi-mongodb/src/main/java/com/neo/model/repository/primary/PrimaryMongoObject.java
.../com/neo/model/repository/primary/PrimaryMongoObject.java
+0
-28
spring-boot-multi-mongodb/src/main/java/com/neo/model/repository/secondary/SecondaryMongoObject.java
.../neo/model/repository/secondary/SecondaryMongoObject.java
+0
-29
spring-boot-multi-mongodb/src/main/resources/application.yml
spring-boot-multi-mongodb/src/main/resources/application.yml
+0
-9
spring-boot-package/pom.xml
spring-boot-package/pom.xml
+53
-0
spring-boot-package/src/main/java/com/neo/PackageApplication.java
...oot-package/src/main/java/com/neo/PackageApplication.java
+19
-0
spring-boot-package/src/main/java/com/neo/controller/HelloController.java
...age/src/main/java/com/neo/controller/HelloController.java
+13
-0
spring-boot-package/src/main/resources/application-dev.properties
...oot-package/src/main/resources/application-dev.properties
+2
-0
spring-boot-package/src/main/resources/application-pro.properties
...oot-package/src/main/resources/application-pro.properties
+2
-0
spring-boot-package/src/main/resources/application-test.properties
...ot-package/src/main/resources/application-test.properties
+2
-0
spring-boot-package/src/main/resources/application.properties
...ng-boot-package/src/main/resources/application.properties
+26
-0
spring-boot-package/src/test/java/com/neo/PackageApplicationTests.java
...ackage/src/test/java/com/neo/PackageApplicationTests.java
+1
-1
spring-boot-package/src/test/java/com/neo/controller/HelloTests.java
...-package/src/test/java/com/neo/controller/HelloTests.java
+36
-0
spring-boot-package/src/test/java/com/neo/controller/HelloWorldControlerTests.java
...est/java/com/neo/controller/HelloWorldControlerTests.java
+34
-0
spring-boot-shiro/pom.xml
spring-boot-shiro/pom.xml
+1
-1
spring-boot-shiro/src/main/java/com/neo/ShiroApplication.java
...ng-boot-shiro/src/main/java/com/neo/ShiroApplication.java
+12
-0
spring-boot-shiro/src/main/java/com/neo/config/MyShiroRealm.java
...boot-shiro/src/main/java/com/neo/config/MyShiroRealm.java
+3
-3
spring-boot-shiro/src/main/java/com/neo/dao/UserInfoDao.java
spring-boot-shiro/src/main/java/com/neo/dao/UserInfoDao.java
+1
-1
spring-boot-shiro/src/main/java/com/neo/model/SysPermission.java
...boot-shiro/src/main/java/com/neo/model/SysPermission.java
+1
-1
spring-boot-shiro/src/main/java/com/neo/model/SysRole.java
spring-boot-shiro/src/main/java/com/neo/model/SysRole.java
+1
-1
spring-boot-shiro/src/main/java/com/neo/model/UserInfo.java
spring-boot-shiro/src/main/java/com/neo/model/UserInfo.java
+1
-1
spring-boot-shiro/src/main/java/com/neo/sevice/UserInfoService.java
...t-shiro/src/main/java/com/neo/sevice/UserInfoService.java
+1
-1
spring-boot-shiro/src/main/java/com/neo/sevice/impl/UserInfoServiceImpl.java
...rc/main/java/com/neo/sevice/impl/UserInfoServiceImpl.java
+1
-1
spring-boot-shiro/src/main/resources/application.yml
spring-boot-shiro/src/main/resources/application.yml
+3
-5
spring-boot-shiro/src/test/java/com/neo/ShiroApplicationTests.java
...ot-shiro/src/test/java/com/neo/ShiroApplicationTests.java
+16
-0
未找到文件。
spring-boot-jpa-thymeleaf-curd/pom.xml
浏览文件 @
b8543683
...
...
@@ -7,7 +7,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.6
.RELEASE
</version>
<version>
2.1.0
.RELEASE
</version>
</parent>
<properties>
...
...
spring-boot-jpa-thymeleaf-curd/spring-boot-jpa-thymeleaf-curd.iml
0 → 100644
浏览文件 @
b8543683
<?xml version="1.0" encoding="UTF-8"?>
<module
org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=
"true"
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"FacetManager"
>
<facet
type=
"Spring"
name=
"Spring"
>
<configuration
/>
</facet>
</component>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_8"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/resources"
type=
"java-resource"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
<orderEntry
type=
"inheritedJdk"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-web:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-logging:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ch.qos.logback:logback-classic:1.2.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: ch.qos.logback:logback-core:1.2.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.logging.log4j:log4j-api:2.11.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:jul-to-slf4j:1.7.25"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.annotation:javax.annotation-api:1.3.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-core:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-jcl:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
scope=
"RUNTIME"
name=
"Maven: org.yaml:snakeyaml:1.23"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-json:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.core:jackson-databind:2.9.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.core:jackson-core:2.9.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.12"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.validation:validation-api:2.0.1.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.jboss.logging:jboss-logging:3.3.2.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.fasterxml:classmate:1.4.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-web:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-beans:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-webmvc:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-aop:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-context:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-expression:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.thymeleaf:thymeleaf-spring5:3.0.11.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.thymeleaf:thymeleaf:3.0.11.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.attoparser:attoparser:2.0.5.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.unbescape:unbescape:1.1.6.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.slf4j:slf4j-api:1.7.25"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.1.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-data-jpa:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-aop:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.aspectj:aspectjweaver:1.9.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-starter-jdbc:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: com.zaxxer:HikariCP:3.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-jdbc:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.transaction:javax.transaction-api:1.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.xml.bind:jaxb-api:2.3.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.activation:javax.activation-api:1.2.0"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate:hibernate-core:5.3.7.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: javax.persistence:javax.persistence-api:2.2"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.javassist:javassist:3.23.1-GA"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: net.bytebuddy:byte-buddy:1.9.3"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: antlr:antlr:2.7.7"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.jboss:jandex:2.0.5.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.dom4j:dom4j:2.1.1"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.hibernate.common:hibernate-commons-annotations:5.0.4.Final"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.data:spring-data-jpa:2.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.data:spring-data-commons:2.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-orm:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-tx:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework:spring-aspects:5.1.2.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: mysql:mysql-connector-java:8.0.13"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-devtools:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot:2.1.0.RELEASE"
level=
"project"
/>
<orderEntry
type=
"library"
name=
"Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.0.RELEASE"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/JpaThymeleafApplication.java
浏览文件 @
b8543683
...
...
@@ -3,7 +3,7 @@ package com.neo;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.support.SpringBootServletInitializer
;
import
org.springframework.boot.web.s
ervlet.s
upport.SpringBootServletInitializer
;
@SpringBootApplication
...
...
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/
entity
/User.java
→
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/
model
/User.java
浏览文件 @
b8543683
package
com.neo.
entity
;
package
com.neo.
model
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
...
...
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/repository/UserRepository.java
浏览文件 @
b8543683
package
com.neo.repository
;
import
com.neo.
entity
.User
;
import
com.neo.
model
.User
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
UserRepository
extends
JpaRepository
<
User
,
Long
>
{
User
findById
(
long
id
);
Long
deleteById
(
Long
id
);
void
deleteById
(
Long
id
);
}
\ No newline at end of file
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/service/UserService.java
浏览文件 @
b8543683
package
com.neo.service
;
import
com.neo.
entity
.User
;
import
com.neo.
model
.User
;
import
java.util.List
;
...
...
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/service/impl/UserServiceImpl.java
浏览文件 @
b8543683
package
com.neo.service.impl
;
import
com.neo.
entity
.User
;
import
com.neo.
model
.User
;
import
com.neo.repository.UserRepository
;
import
com.neo.service.UserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
...
...
@@ -37,7 +36,7 @@ public class UserServiceImpl implements UserService{
@Override
public
void
delete
(
long
id
)
{
userRepository
.
delete
(
id
);
userRepository
.
delete
ById
(
id
);
}
}
...
...
spring-boot-jpa-thymeleaf-curd/src/main/java/com/neo/web/UserController.java
浏览文件 @
b8543683
package
com.neo.web
;
import
com.neo.
entity
.User
;
import
com.neo.
model
.User
;
import
com.neo.service.UserService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Service
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.annotation.Resource
;
import
java.util.List
;
...
...
spring-boot-jpa-thymeleaf-curd/src/main/resources/application.properties
浏览文件 @
b8543683
spring.datasource.url
=
jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true
spring.datasource.username
=
root
spring.datasource.password
=
root
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.datasource.driver-class-name
=
com.mysql.
cj.
jdbc.Driver
spring.jpa.properties.hibernate.hbm2ddl.auto
=
update
spring.jpa.properties.hibernate.dialect
=
org.hibernate.dialect.MySQL5InnoDBDialect
...
...
spring-boot-jpa-thymeleaf-curd/target/classes/application.properties
0 → 100644
浏览文件 @
b8543683
spring.datasource.url
=
jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=true
spring.datasource.username
=
root
spring.datasource.password
=
root
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.hbm2ddl.auto
=
update
spring.jpa.properties.hibernate.dialect
=
org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql
=
true
spring.thymeleaf.cache
=
false
\ No newline at end of file
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/JpaThymeleafApplication.class
0 → 100644
浏览文件 @
b8543683
文件已添加
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/model/User.class
0 → 100644
浏览文件 @
b8543683
文件已添加
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/repository/UserRepository.class
0 → 100644
浏览文件 @
b8543683
文件已添加
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/service/UserService.class
0 → 100644
浏览文件 @
b8543683
文件已添加
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/service/impl/UserServiceImpl.class
0 → 100644
浏览文件 @
b8543683
文件已添加
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/web/HelloController.class
0 → 100644
浏览文件 @
b8543683
文件已添加
spring-boot-jpa-thymeleaf-curd/target/classes/com/neo/web/UserController.class
0 → 100644
浏览文件 @
b8543683
文件已添加
spring-boot-jpa-thymeleaf-curd/target/classes/static/css/bootstrap.css
0 → 100644
浏览文件 @
b8543683
此差异已折叠。
点击以展开。
spring-boot-jpa-thymeleaf-curd/target/classes/templates/hello.html
0 → 100644
浏览文件 @
b8543683
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
Hello Thymeleaf!
</title>
</head>
<body>
<p
th:text=
"'Hello, ' + ${name} + '!'"
/>
</body>
</html>
\ No newline at end of file
spring-boot-jpa-thymeleaf-curd/target/classes/templates/user/list.html
0 → 100644
浏览文件 @
b8543683
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
userList
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
用户列表
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
#
</th>
<th>
User Name
</th>
<th>
Password
</th>
<th>
Age
</th>
<th>
Edit
</th>
<th>
Delete
</th>
</tr>
</thead>
<tbody>
<tr
th:each=
"user : ${users}"
>
<th
scope=
"row"
th:text=
"${user.id}"
>
1
</th>
<td
th:text=
"${user.userName}"
>
neo
</td>
<td
th:text=
"${user.password}"
>
Otto
</td>
<td
th:text=
"${user.age}"
>
6
</td>
<td><a
th:href=
"@{/toEdit(id=${user.id})}"
>
edit
</a></td>
<td><a
th:href=
"@{/delete(id=${user.id})}"
>
delete
</a></td>
</tr>
</tbody>
</table>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-2 control-label"
>
<a
href=
"/toAdd"
th:href=
"@{/toAdd}"
class=
"btn btn-info"
>
add
</a>
</div>
</div>
</body>
</html>
\ No newline at end of file
spring-boot-jpa-thymeleaf-curd/target/classes/templates/user/userAdd.html
0 → 100644
浏览文件 @
b8543683
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
user
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
添加用户
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<form
class=
"form-horizontal"
th:action=
"@{/add}"
method=
"post"
>
<div
class=
"form-group"
>
<label
for=
"userName"
class=
"col-sm-2 control-label"
>
userName
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"userName"
id=
"userName"
placeholder=
"userName"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-sm-2 control-label"
>
Password
</label>
<div
class=
"col-sm-10"
>
<input
type=
"password"
class=
"form-control"
name=
"password"
id=
"password"
placeholder=
"Password"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"age"
class=
"col-sm-2 control-label"
>
age
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"age"
id=
"age"
placeholder=
"age"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<input
type=
"submit"
value=
"Submit"
class=
"btn btn-info"
/>
<input
type=
"reset"
value=
"Reset"
class=
"btn btn-info"
/>
</div>
</div>
</form>
</div>
</body>
</html>
spring-boot-jpa-thymeleaf-curd/target/classes/templates/user/userEdit.html
0 → 100644
浏览文件 @
b8543683
<!DOCTYPE html>
<html
lang=
"en"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
/>
<title>
user
</title>
<link
rel=
"stylesheet"
th:href=
"@{/css/bootstrap.css}"
></link>
</head>
<body
class=
"container"
>
<br/>
<h1>
修改用户
</h1>
<br/><br/>
<div
class=
"with:80%"
>
<form
class=
"form-horizontal"
th:action=
"@{/edit}"
th:object=
"${user}"
method=
"post"
>
<input
type=
"hidden"
name=
"id"
th:value=
"*{id}"
/>
<div
class=
"form-group"
>
<label
for=
"userName"
class=
"col-sm-2 control-label"
>
userName
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"userName"
id=
"userName"
th:value=
"*{userName}"
placeholder=
"userName"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-sm-2 control-label"
>
Password
</label>
<div
class=
"col-sm-10"
>
<input
type=
"password"
class=
"form-control"
name=
"password"
id=
"password"
th:value=
"*{password}"
placeholder=
"Password"
/>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"age"
class=
"col-sm-2 control-label"
>
age
</label>
<div
class=
"col-sm-10"
>
<input
type=
"text"
class=
"form-control"
name=
"age"
id=
"age"
th:value=
"*{age}"
placeholder=
"age"
/>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-offset-2 col-sm-10"
>
<input
type=
"submit"
value=
"Submit"
class=
"btn btn-info"
/>
<a
href=
"/toAdd"
th:href=
"@{/list}"
class=
"btn btn-info"
>
Back
</a>
</div>
</div>
</form>
</div>
</body>
</html>
spring-boot-mail/pom.xml
浏览文件 @
b8543683
...
...
@@ -14,7 +14,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.3
.RELEASE
</version>
<version>
2.1.0
.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
...
...
@@ -24,24 +24,10 @@
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-mail
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-context-support
</artifactId>
...
...
@@ -57,6 +43,11 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
...
...
spring-boot-
shiro/src/main/java/com/neo/SpringBootShiro
Application.java
→
spring-boot-
mail/src/main/java/com/neo/Mail
Application.java
浏览文件 @
b8543683
...
...
@@ -4,9 +4,9 @@ import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
SpringBootShiro
Application
{
public
class
Mail
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SpringBootShiro
Application
.
class
,
args
);
SpringApplication
.
run
(
Mail
Application
.
class
,
args
);
}
}
spring-boot-m
ongodb/src/test/java/com/neo/
ApplicationTests.java
→
spring-boot-m
ail/src/test/java/com/neo/Mail
ApplicationTests.java
浏览文件 @
b8543683
...
...
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
ApplicationTests
{
public
class
Mail
ApplicationTests
{
@Test
public
void
contextLoads
()
{
...
...
spring-boot-mongodb/pom.xml
→
spring-boot-mongodb/
spring-boot-mongodb/
pom.xml
浏览文件 @
b8543683
...
...
@@ -14,7 +14,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.3
.RELEASE
</version>
<version>
2.1.0
.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
...
...
@@ -25,23 +25,14 @@
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
</dependency>
</dependencies>
<build>
...
...
@@ -49,9 +40,6 @@
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<fork>
true
</fork>
</configuration>
</plugin>
</plugins>
</build>
...
...
spring-boot-mongodb/s
rc/main/java/com/neo/
Application.java
→
spring-boot-mongodb/s
pring-boot-mongodb/src/main/java/com/neo/MongoDB
Application.java
浏览文件 @
b8543683
...
...
@@ -2,12 +2,11 @@ package com.neo;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@SpringBootApplication
public
class
Application
{
public
class
MongoDB
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
SpringApplication
.
run
(
MongoDB
Application
.
class
,
args
);
}
}
spring-boot-mongodb/s
rc/main/java/com/neo/entity/UserEntity
.java
→
spring-boot-mongodb/s
pring-boot-mongodb/src/main/java/com/neo/model/User
.java
浏览文件 @
b8543683
package
com.neo.
entity
;
package
com.neo.
model
;
import
java.io.Serializable
;
/**
* Created by summer on 2017/5/5.
*/
public
class
User
Entity
implements
Serializable
{
public
class
User
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3258839839160856613L
;
private
Long
id
;
private
String
userName
;
...
...
spring-boot-mongodb/spring-boot-mongodb/src/main/java/com/neo/repository/UserRepository.java
0 → 100644
浏览文件 @
b8543683
package
com.neo.repository
;
import
com.neo.model.User
;
/**
* Created by summer on 2017/5/5.
*/
public
interface
UserRepository
{
public
void
saveUser
(
User
user
);
public
User
findUserByUserName
(
String
userName
);
public
long
updateUser
(
User
user
);
public
void
deleteUserById
(
Long
id
);
}
spring-boot-mongodb/s
rc/main/java/com/neo/dao/impl/UserDao
Impl.java
→
spring-boot-mongodb/s
pring-boot-mongodb/src/main/java/com/neo/repository/impl/UserRepository
Impl.java
浏览文件 @
b8543683
package
com.neo.
dao
.impl
;
package
com.neo.
repository
.impl
;
import
com.mongodb.
Wri
teResult
;
import
com.neo.
dao.UserDao
;
import
com.neo.
entity.UserEntity
;
import
com.mongodb.
client.result.Upda
teResult
;
import
com.neo.
repository.UserRepository
;
import
com.neo.
model.User
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
...
...
@@ -15,7 +14,7 @@ import org.springframework.stereotype.Component;
* Created by summer on 2017/5/5.
*/
@Component
public
class
User
DaoImpl
implements
UserDao
{
public
class
User
RepositoryImpl
implements
UserRepository
{
@Autowired
private
MongoTemplate
mongoTemplate
;
...
...
@@ -25,7 +24,7 @@ public class UserDaoImpl implements UserDao {
* @param user
*/
@Override
public
void
saveUser
(
User
Entity
user
)
{
public
void
saveUser
(
User
user
)
{
mongoTemplate
.
save
(
user
);
}
...
...
@@ -35,9 +34,9 @@ public class UserDaoImpl implements UserDao {
* @return
*/
@Override
public
User
Entity
findUserByUserName
(
String
userName
)
{
public
User
findUserByUserName
(
String
userName
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"userName"
).
is
(
userName
));
User
Entity
user
=
mongoTemplate
.
findOne
(
query
,
UserEntity
.
class
);
User
user
=
mongoTemplate
.
findOne
(
query
,
User
.
class
);
return
user
;
}
...
...
@@ -46,15 +45,15 @@ public class UserDaoImpl implements UserDao {
* @param user
*/
@Override
public
int
updateUser
(
UserEntity
user
)
{
public
long
updateUser
(
User
user
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"id"
).
is
(
user
.
getId
()));
Update
update
=
new
Update
().
set
(
"userName"
,
user
.
getUserName
()).
set
(
"passWord"
,
user
.
getPassWord
());
//更新查询返回结果集的第一条
WriteResult
result
=
mongoTemplate
.
updateFirst
(
query
,
update
,
UserEntity
.
class
);
UpdateResult
result
=
mongoTemplate
.
updateFirst
(
query
,
update
,
User
.
class
);
//更新查询返回结果集的所有
// mongoTemplate.updateMulti(query,update,UserEntity.class);
if
(
result
!=
null
)
return
result
.
get
N
();
return
result
.
get
MatchedCount
();
else
return
0
;
}
...
...
@@ -66,6 +65,6 @@ public class UserDaoImpl implements UserDao {
@Override
public
void
deleteUserById
(
Long
id
)
{
Query
query
=
new
Query
(
Criteria
.
where
(
"id"
).
is
(
id
));
mongoTemplate
.
remove
(
query
,
User
Entity
.
class
);
mongoTemplate
.
remove
(
query
,
User
.
class
);
}
}
spring-boot-mongodb/spring-boot-mongodb/src/main/resources/application.properties
0 → 100644
浏览文件 @
b8543683
spring.application.name
=
spring-boot-mongodb
spring.data.mongodb.uri
=
mongodb://192.168.0.75:20000/test
spring-boot-m
ail/src/test/java/com/neo/
ApplicationTests.java
→
spring-boot-m
ongodb/spring-boot-mongodb/src/test/java/com/neo/MongoDB
ApplicationTests.java
浏览文件 @
b8543683
...
...
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
ApplicationTests
{
public
class
MongoDB
ApplicationTests
{
@Test
public
void
contextLoads
()
{
...
...
spring-boot-mongodb/s
rc/test/java/com/neo/dao/UserDao
Test.java
→
spring-boot-mongodb/s
pring-boot-mongodb/src/test/java/com/neo/repository/UserRepository
Test.java
浏览文件 @
b8543683
package
com.neo.
dao
;
package
com.neo.
repository
;
import
com.neo.
entity.UserEntity
;
import
com.neo.
model.User
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -12,14 +12,14 @@ import org.springframework.test.context.junit4.SpringRunner;
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
User
Dao
Test
{
public
class
User
Repository
Test
{
@Autowired
private
User
Dao
userDao
;
private
User
Repository
userDao
;
@Test
public
void
testSaveUser
()
throws
Exception
{
User
Entity
user
=
new
UserEntity
();
User
user
=
new
User
();
user
.
setId
(
2
l
);
user
.
setUserName
(
"小明"
);
user
.
setPassWord
(
"fffooo123"
);
...
...
@@ -28,13 +28,13 @@ public class UserDaoTest {
@Test
public
void
findUserByUserName
(){
User
Entity
user
=
userDao
.
findUserByUserName
(
"小明"
);
User
user
=
userDao
.
findUserByUserName
(
"小明"
);
System
.
out
.
println
(
"user is "
+
user
);
}
@Test
public
void
updateUser
(){
User
Entity
user
=
new
UserEntity
();
User
user
=
new
User
();
user
.
setId
(
2
l
);
user
.
setUserName
(
"天空"
);
user
.
setPassWord
(
"fffxxxx"
);
...
...
spring-boot-multi-mongodb/pom.xml
→
spring-boot-m
ongodb/spring-boot-m
ulti-mongodb/pom.xml
浏览文件 @
b8543683
...
...
@@ -14,8 +14,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.3.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
<version>
2.1.0.RELEASE
</version>
</parent>
<properties>
...
...
@@ -27,20 +26,10 @@
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-autoconfigure
</artifactId>
<version>
RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
...
...
@@ -49,9 +38,6 @@
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<fork>
true
</fork>
</configuration>
</plugin>
</plugins>
</build>
...
...
spring-boot-m
ail/src/main/java/com/neo/
Application.java
→
spring-boot-m
ongodb/spring-boot-multi-mongodb/src/main/java/com/neo/MultiMongodb
Application.java
浏览文件 @
b8543683
...
...
@@ -2,12 +2,11 @@ package com.neo;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@SpringBootApplication
public
class
Application
{
public
class
MultiMongodb
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
SpringApplication
.
run
(
MultiMongodb
Application
.
class
,
args
);
}
}
spring-boot-multi-mongodb/src/main/java/com/neo/config/MultipleMongoConfig.java
→
spring-boot-m
ongodb/spring-boot-m
ulti-mongodb/src/main/java/com/neo/config/MultipleMongoConfig.java
浏览文件 @
b8543683
package
com.neo.config
;
import
com.mongodb.MongoClient
;
import
com.mongodb.MongoClientURI
;
import
com.neo.config.props.MultipleMongoProperties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
...
...
@@ -12,23 +13,20 @@ import org.springframework.data.mongodb.MongoDbFactory;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.SimpleMongoDbFactory
;
/**
* @author neo
*/
@Configuration
public
class
MultipleMongoConfig
{
@Autowired
private
MultipleMongoProperties
mongoProperties
;
private
MultipleMongoProperties
mongoProperties
;
@Primary
@Bean
(
name
=
PrimaryMongoConfig
.
MONGO_TEMPLATE
)
@Bean
(
name
=
"primaryMongoTemplate"
)
public
MongoTemplate
primaryMongoTemplate
()
throws
Exception
{
return
new
MongoTemplate
(
primaryFactory
(
this
.
mongoProperties
.
getPrimary
()));
}
@Bean
@Qualifier
(
SecondaryMongoConfig
.
MONGO_TEMPLATE
)
@Qualifier
(
"secondaryMongoTemplate"
)
public
MongoTemplate
secondaryMongoTemplate
()
throws
Exception
{
return
new
MongoTemplate
(
secondaryFactory
(
this
.
mongoProperties
.
getSecondary
()));
}
...
...
@@ -36,13 +34,13 @@ public class MultipleMongoConfig {
@Bean
@Primary
public
MongoDbFactory
primaryFactory
(
MongoProperties
mongo
)
throws
Exception
{
return
new
SimpleMongoDbFactory
(
new
MongoClient
(
mongo
.
getHost
(),
mongo
.
getPort
()),
mongo
.
getDatabase
());
MongoClient
client
=
new
MongoClient
(
new
MongoClientURI
(
mongoProperties
.
getPrimary
().
getUri
()));
return
new
SimpleMongoDbFactory
(
client
,
mongoProperties
.
getPrimary
()
.
getDatabase
());
}
@Bean
public
MongoDbFactory
secondaryFactory
(
MongoProperties
mongo
)
throws
Exception
{
return
new
SimpleMongoDbFactory
(
new
MongoClient
(
mongo
.
getHost
(),
mongo
.
getPort
()),
mongo
.
getDatabase
());
MongoClient
client
=
new
MongoClient
(
new
MongoClientURI
(
mongoProperties
.
getSecondary
().
getUri
()));
return
new
SimpleMongoDbFactory
(
client
,
mongoProperties
.
getSecondary
()
.
getDatabase
());
}
}
}
\ No newline at end of file
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/config/PrimaryMongoConfig.java
0 → 100644
浏览文件 @
b8543683
package
com.neo.config
;
import
com.mongodb.MongoClient
;
import
com.mongodb.MongoClientURI
;
import
com.neo.config.props.MultipleMongoProperties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.mongo.MongoProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.data.mongodb.MongoDbFactory
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.SimpleMongoDbFactory
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
@Configuration
@EnableConfigurationProperties
(
MultipleMongoProperties
.
class
)
@EnableMongoRepositories
(
basePackages
=
"com.neo.repository.primary"
,
mongoTemplateRef
=
"primaryMongoTemplate"
)
public
class
PrimaryMongoConfig
{
}
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/config/SecondaryMongoConfig.java
0 → 100644
浏览文件 @
b8543683
package
com.neo.config
;
import
com.mongodb.MongoClient
;
import
com.mongodb.MongoClientURI
;
import
com.neo.config.props.MultipleMongoProperties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.autoconfigure.mongo.MongoProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.mongodb.MongoDbFactory
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.SimpleMongoDbFactory
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
@Configuration
@EnableConfigurationProperties
(
MultipleMongoProperties
.
class
)
@EnableMongoRepositories
(
basePackages
=
"com.neo.repository.secondary"
,
mongoTemplateRef
=
"secondaryMongoTemplate"
)
public
class
SecondaryMongoConfig
{
}
spring-boot-multi-mongodb/src/main/java/com/neo/config/props/MultipleMongoProperties.java
→
spring-boot-m
ongodb/spring-boot-m
ulti-mongodb/src/main/java/com/neo/config/props/MultipleMongoProperties.java
浏览文件 @
b8543683
package
com.neo.config.props
;
import
lombok.Data
;
import
org.springframework.boot.autoconfigure.mongo.MongoProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
/**
* @author neo
*/
@Data
@ConfigurationProperties
(
prefix
=
"mongodb"
)
public
class
MultipleMongoProperties
{
private
MongoProperties
primary
=
new
MongoProperties
();
private
MongoProperties
secondary
=
new
MongoProperties
();
public
MongoProperties
getPrimary
()
{
return
primary
;
}
public
void
setPrimary
(
MongoProperties
primary
)
{
this
.
primary
=
primary
;
}
public
MongoProperties
getSecondary
()
{
return
secondary
;
}
public
void
setSecondary
(
MongoProperties
secondary
)
{
this
.
secondary
=
secondary
;
}
}
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/java/com/neo/model/User.java
0 → 100644
浏览文件 @
b8543683
package
com.neo.model
;
import
java.io.Serializable
;
public
class
User
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3258839839160856613L
;
private
String
id
;
private
String
userName
;
private
String
passWord
;
public
User
(
String
userName
,
String
passWord
)
{
this
.
userName
=
userName
;
this
.
passWord
=
passWord
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getPassWord
()
{
return
passWord
;
}
public
void
setPassWord
(
String
passWord
)
{
this
.
passWord
=
passWord
;
}
@Override
public
String
toString
()
{
return
"User{"
+
"id='"
+
id
+
'\''
+
", userName='"
+
userName
+
'\''
+
", passWord='"
+
passWord
+
'\''
+
'}'
;
}
}
spring-boot-m
ulti-mongodb/src/main/java/com/neo/model
/repository/primary/PrimaryRepository.java
→
spring-boot-m
ongodb/spring-boot-multi-mongodb/src/main/java/com/neo
/repository/primary/PrimaryRepository.java
浏览文件 @
b8543683
package
com.neo.
model.
repository.primary
;
package
com.neo.repository.primary
;
import
com.neo.model.User
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
/**
* @author neo
*/
public
interface
PrimaryRepository
extends
MongoRepository
<
PrimaryMongoObject
,
String
>
{
public
interface
PrimaryRepository
extends
MongoRepository
<
User
,
String
>
{
}
spring-boot-m
ulti-mongodb/src/main/java/com/neo/model
/repository/secondary/SecondaryRepository.java
→
spring-boot-m
ongodb/spring-boot-multi-mongodb/src/main/java/com/neo
/repository/secondary/SecondaryRepository.java
浏览文件 @
b8543683
package
com.neo.
model.
repository.secondary
;
package
com.neo.repository.secondary
;
import
com.neo.model.User
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
/**
* @author neo
*/
public
interface
SecondaryRepository
extends
MongoRepository
<
SecondaryMongoObject
,
String
>
{
public
interface
SecondaryRepository
extends
MongoRepository
<
User
,
String
>
{
}
spring-boot-mongodb/spring-boot-multi-mongodb/src/main/resources/application.properties
0 → 100644
浏览文件 @
b8543683
spring.application.name
=
spring-boot-multi-mongodb
mongodb.primary.uri
=
mongodb://192.168.0.75:20000
mongodb.primary.database
=
primary
mongodb.secondary.uri
=
mongodb://192.168.0.75:20000
mongodb.secondary.database
=
secondary
spring-boot-m
ulti-mongodb/src/test/java/com/neo/
ApplicationTests.java
→
spring-boot-m
ongodb/spring-boot-multi-mongodb/src/test/java/com/neo/MultiMongodb
ApplicationTests.java
浏览文件 @
b8543683
...
...
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
ApplicationTests
{
public
class
MultiMongodb
ApplicationTests
{
@Test
public
void
contextLoads
()
{
...
...
spring-boot-m
ulti-mongodb/src/test/java/com/neo/model
/repository/MuliDatabaseTest.java
→
spring-boot-m
ongodb/spring-boot-multi-mongodb/src/test/java/com/neo
/repository/MuliDatabaseTest.java
浏览文件 @
b8543683
package
com.neo.
model.
repository
;
package
com.neo.repository
;
import
com.neo.model.repository.primary.PrimaryMongoObject
;
import
com.neo.model.repository.primary.PrimaryRepository
;
import
com.neo.model.repository.secondary.SecondaryMongoObject
;
import
com.neo.model.repository.secondary.SecondaryRepository
;
import
com.neo.model.User
;
import
com.neo.repository.primary.PrimaryRepository
;
import
com.neo.repository.secondary.SecondaryRepository
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -12,9 +11,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import
java.util.List
;
/**
* Created by neo on 2017/5/6.
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
MuliDatabaseTest
{
...
...
@@ -27,28 +24,19 @@ public class MuliDatabaseTest {
@Test
public
void
TestSave
()
{
System
.
out
.
println
(
"************************************************************"
);
System
.
out
.
println
(
"测试开始"
);
System
.
out
.
println
(
"************************************************************"
);
this
.
primaryRepository
.
save
(
new
PrimaryMongoObject
(
null
,
"第一个库的对象"
));
this
.
secondaryRepository
.
save
(
new
SecondaryMongoObject
(
null
,
"第二个库的对象"
));
List
<
PrimaryMongoObject
>
primaries
=
this
.
primaryRepository
.
findAll
();
for
(
PrimaryMongoObject
primary
:
primaries
)
{
this
.
primaryRepository
.
save
(
new
User
(
"小张"
,
"123456"
));
this
.
secondaryRepository
.
save
(
new
User
(
"小王"
,
"654321"
));
List
<
User
>
primaries
=
this
.
primaryRepository
.
findAll
();
for
(
User
primary
:
primaries
)
{
System
.
out
.
println
(
primary
.
toString
());
}
List
<
SecondaryMongoObject
>
secondaries
=
this
.
secondaryRepository
.
findAll
();
for
(
SecondaryMongoObject
secondary
:
secondaries
)
{
List
<
User
>
secondaries
=
this
.
secondaryRepository
.
findAll
();
for
(
User
secondary
:
secondaries
)
{
System
.
out
.
println
(
secondary
.
toString
());
}
System
.
out
.
println
(
"************************************************************"
);
System
.
out
.
println
(
"测试完成"
);
System
.
out
.
println
(
"************************************************************"
);
...
...
spring-boot-mongodb/src/main/java/com/neo/dao/UserDao.java
已删除
100644 → 0
浏览文件 @
ed67c898
package
com.neo.dao
;
import
com.neo.entity.UserEntity
;
/**
* Created by summer on 2017/5/5.
*/
public
interface
UserDao
{
public
void
saveUser
(
UserEntity
user
);
public
UserEntity
findUserByUserName
(
String
userName
);
public
int
updateUser
(
UserEntity
user
);
public
void
deleteUserById
(
Long
id
);
}
spring-boot-mongodb/src/main/resources/application.properties
已删除
100644 → 0
浏览文件 @
ed67c898
spring.application.name
=
spirng-boot-mongodb
spring.data.mongodb.uri
=
mongodb://192.168.9.61:20000/test
spring-boot-multi-mongodb/src/main/java/com/neo/Application.java
已删除
100644 → 0
浏览文件 @
ed67c898
package
com.neo
;
import
com.neo.config.props.MultipleMongoProperties
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@EnableConfigurationProperties
(
MultipleMongoProperties
.
class
)
@SpringBootApplication
(
exclude
=
MongoAutoConfiguration
.
class
)
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
}
}
spring-boot-multi-mongodb/src/main/java/com/neo/config/PrimaryMongoConfig.java
已删除
100644 → 0
浏览文件 @
ed67c898
package
com.neo.config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
/**
* @author neo
*/
@Configuration
@EnableMongoRepositories
(
basePackages
=
"com.neo.model.repository.primary"
,
mongoTemplateRef
=
PrimaryMongoConfig
.
MONGO_TEMPLATE
)
public
class
PrimaryMongoConfig
{
protected
static
final
String
MONGO_TEMPLATE
=
"primaryMongoTemplate"
;
}
spring-boot-multi-mongodb/src/main/java/com/neo/config/SecondaryMongoConfig.java
已删除
100644 → 0
浏览文件 @
ed67c898
package
com.neo.config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.mongodb.repository.config.EnableMongoRepositories
;
/**
* @author neo
*/
@Configuration
@EnableMongoRepositories
(
basePackages
=
"com.neo.model.repository.secondary"
,
mongoTemplateRef
=
SecondaryMongoConfig
.
MONGO_TEMPLATE
)
public
class
SecondaryMongoConfig
{
protected
static
final
String
MONGO_TEMPLATE
=
"secondaryMongoTemplate"
;
}
spring-boot-multi-mongodb/src/main/java/com/neo/model/repository/primary/PrimaryMongoObject.java
已删除
100644 → 0
浏览文件 @
ed67c898
package
com.neo.model.repository.primary
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
* @author neo
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document
(
collection
=
"first_mongo"
)
public
class
PrimaryMongoObject
{
@Id
private
String
id
;
private
String
value
;
@Override
public
String
toString
()
{
return
"PrimaryMongoObject{"
+
"id='"
+
id
+
'\''
+
", value='"
+
value
+
'\''
+
'}'
;
}
}
spring-boot-multi-mongodb/src/main/java/com/neo/model/repository/secondary/SecondaryMongoObject.java
已删除
100644 → 0
浏览文件 @
ed67c898
package
com.neo.model.repository.secondary
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
/**
* @author neo
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document
(
collection
=
"second_mongo"
)
public
class
SecondaryMongoObject
{
@Id
private
String
id
;
private
String
value
;
@Override
public
String
toString
()
{
return
"SecondaryMongoObject{"
+
"id='"
+
id
+
'\''
+
", value='"
+
value
+
'\''
+
'}'
;
}
}
spring-boot-multi-mongodb/src/main/resources/application.yml
已删除
100644 → 0
浏览文件 @
ed67c898
mongodb
:
primary
:
host
:
192.168.9.60
port
:
20000
database
:
test
secondary
:
host
:
192.168.9.61
port
:
20000
database
:
test1
\ No newline at end of file
spring-boot-package/pom.xml
0 → 100644
浏览文件 @
b8543683
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
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.neo
</groupId>
<artifactId>
spring-boot-package
</artifactId>
<version>
1.0.0
</version>
<packaging>
jar
</packaging>
<name>
spring-boot-package
</name>
<description>
Demo project for Spring Boot package war
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.1.0.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<java.version>
1.8
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
spring-boot-package/src/main/java/com/neo/PackageApplication.java
0 → 100644
浏览文件 @
b8543683
package
com.neo
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
@SpringBootApplication
public
class
PackageApplication
extends
SpringBootServletInitializer
{
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
return
application
.
sources
(
PackageApplication
.
class
);
}
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
PackageApplication
.
class
,
args
);
}
}
spring-boot-package/src/main/java/com/neo/controller/HelloController.java
0 → 100644
浏览文件 @
b8543683
package
com.neo.controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
public
class
HelloController
{
@RequestMapping
(
"/hello"
)
public
String
index
()
{
return
"Hello World"
;
}
}
\ No newline at end of file
spring-boot-package/src/main/resources/application-dev.properties
0 → 100644
浏览文件 @
b8543683
info.app.name
=
spring-boot-test
info.app.version
=
1.0.0
\ No newline at end of file
spring-boot-package/src/main/resources/application-pro.properties
0 → 100644
浏览文件 @
b8543683
info.app.name
=
spring-boot-pro
info.app.version
=
1.0.0
\ No newline at end of file
spring-boot-package/src/main/resources/application-test.properties
0 → 100644
浏览文件 @
b8543683
info.app.name
=
spring-boot-uat
info.app.version
=
1.0.0
\ No newline at end of file
spring-boot-package/src/main/resources/application.properties
0 → 100644
浏览文件 @
b8543683
# \u9879\u76EEcontextPath\uFF0C\u4E00\u822C\u4E0D\u914D\u7F6E
#server.servlet.context-path=/myspringboot
# \u9519\u8BEF\u9875\uFF0C\u6307\u5B9A\u53D1\u751F\u9519\u8BEF\u65F6\uFF0C\u8DF3\u8F6C\u7684URL\u3002
server.error.path
=
/error
# \u670D\u52A1\u7AEF\u53E3
server.port
=
8080
# session\u6700\u5927\u8D85\u65F6\u65F6\u95F4(\u5206\u949F)\uFF0C\u9ED8\u8BA4\u4E3A30
server.session-timeout
=
60
# \u8BE5\u670D\u52A1\u7ED1\u5B9AIP\u5730\u5740\uFF0C\u542F\u52A8\u670D\u52A1\u5668\u65F6\u5982\u672C\u673A\u4E0D\u662F\u8BE5IP\u5730\u5740\u5219\u629B\u51FA\u5F02\u5E38\u542F\u52A8\u5931\u8D25\uFF0C\u53EA\u6709\u7279\u6B8A\u9700\u6C42\u7684\u60C5\u51B5\u4E0B\u624D\u914D\u7F6E
#server.address=192.168.0.6
# tomcat \u6700\u5927\u7EBF\u7A0B\u6570\uFF0C\u9ED8\u8BA4\u4E3A200
server.tomcat.max-threads
=
600
# tomcat\u7684URI\u7F16\u7801
server.tomcat.uri-encoding
=
UTF-8
# \u5B58\u653ETomcat\u7684\u65E5\u5FD7\u3001Dump\u7B49\u6587\u4EF6\u7684\u4E34\u65F6\u6587\u4EF6\u5939\uFF0C\u9ED8\u8BA4\u4E3A\u7CFB\u7EDF\u7684tmp\u6587\u4EF6\u5939
server.tomcat.basedir
=
/tmp/log
# \u6253\u5F00Tomcat\u7684Access\u65E5\u5FD7\uFF0C\u5E76\u53EF\u4EE5\u8BBE\u7F6E\u65E5\u5FD7\u683C\u5F0F
#server.tomcat.access-log-enabled=true
#server.tomcat.access-log-pattern=
# accesslog\u76EE\u5F55\uFF0C\u9ED8\u8BA4\u5728basedir/logs
#server.tomcat.accesslog.directory=
# \u65E5\u5FD7\u6587\u4EF6\u76EE\u5F55
logging.path
=
/tmp/log
# \u65E5\u5FD7\u6587\u4EF6\u540D\u79F0\uFF0C\u9ED8\u8BA4\u4E3Aspring.log
logging.file
=
myapp.log
\ No newline at end of file
spring-boot-
shiro/src/test/java/com/neo/SpringBootShiro
ApplicationTests.java
→
spring-boot-
package/src/test/java/com/neo/Package
ApplicationTests.java
浏览文件 @
b8543683
...
...
@@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
SpringBootShiro
ApplicationTests
{
public
class
Package
ApplicationTests
{
@Test
public
void
contextLoads
()
{
...
...
spring-boot-package/src/test/java/com/neo/controller/HelloTests.java
0 → 100644
浏览文件 @
b8543683
package
com.neo.controller
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.http.MediaType
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.request.MockMvcRequestBuilders
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
content
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
HelloTests
{
private
MockMvc
mvc
;
@Before
public
void
setUp
()
throws
Exception
{
mvc
=
MockMvcBuilders
.
standaloneSetup
(
new
HelloController
()).
build
();
}
@Test
public
void
getHello
()
throws
Exception
{
mvc
.
perform
(
MockMvcRequestBuilders
.
get
(
"/hello"
).
accept
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
string
(
equalTo
(
"Hello World"
)));
}
}
\ No newline at end of file
spring-boot-package/src/test/java/com/neo/controller/HelloWorldControlerTests.java
0 → 100644
浏览文件 @
b8543683
package
com.neo.controller
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.http.MediaType
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.request.MockMvcRequestBuilders
;
import
org.springframework.test.web.servlet.result.MockMvcResultHandlers
;
import
org.springframework.test.web.servlet.result.MockMvcResultMatchers
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
HelloWorldControlerTests
{
private
MockMvc
mvc
;
@Before
public
void
setUp
()
throws
Exception
{
mvc
=
MockMvcBuilders
.
standaloneSetup
(
new
HelloController
()).
build
();
}
@Test
public
void
getHello
()
throws
Exception
{
mvc
.
perform
(
MockMvcRequestBuilders
.
get
(
"/hello"
).
accept
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andReturn
();
}
}
\ No newline at end of file
spring-boot-shiro/pom.xml
浏览文件 @
b8543683
...
...
@@ -14,7 +14,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.4
.RELEASE
</version>
<version>
2.1.0
.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
...
...
spring-boot-shiro/src/main/java/com/neo/ShiroApplication.java
0 → 100644
浏览文件 @
b8543683
package
com.neo
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
ShiroApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ShiroApplication
.
class
,
args
);
}
}
spring-boot-shiro/src/main/java/com/neo/config/MyShiroRealm.java
浏览文件 @
b8543683
package
com.neo.config
;
import
com.neo.
entity
.SysPermission
;
import
com.neo.
entity
.SysRole
;
import
com.neo.
entity
.UserInfo
;
import
com.neo.
model
.SysPermission
;
import
com.neo.
model
.SysRole
;
import
com.neo.
model
.UserInfo
;
import
com.neo.sevice.UserInfoService
;
import
org.apache.shiro.authc.AuthenticationException
;
import
org.apache.shiro.authc.AuthenticationInfo
;
...
...
spring-boot-shiro/src/main/java/com/neo/dao/UserInfoDao.java
浏览文件 @
b8543683
package
com.neo.dao
;
import
com.neo.
entity
.UserInfo
;
import
com.neo.
model
.UserInfo
;
import
org.springframework.data.repository.CrudRepository
;
public
interface
UserInfoDao
extends
CrudRepository
<
UserInfo
,
Long
>
{
...
...
spring-boot-shiro/src/main/java/com/neo/
entity
/SysPermission.java
→
spring-boot-shiro/src/main/java/com/neo/
model
/SysPermission.java
浏览文件 @
b8543683
package
com.neo.
entity
;
package
com.neo.
model
;
import
javax.persistence.*
;
import
java.io.Serializable
;
...
...
spring-boot-shiro/src/main/java/com/neo/
entity
/SysRole.java
→
spring-boot-shiro/src/main/java/com/neo/
model
/SysRole.java
浏览文件 @
b8543683
package
com.neo.
entity
;
package
com.neo.
model
;
import
javax.persistence.*
;
import
java.util.List
;
...
...
spring-boot-shiro/src/main/java/com/neo/
entity
/UserInfo.java
→
spring-boot-shiro/src/main/java/com/neo/
model
/UserInfo.java
浏览文件 @
b8543683
package
com.neo.
entity
;
package
com.neo.
model
;
import
javax.persistence.*
;
import
java.io.Serializable
;
...
...
spring-boot-shiro/src/main/java/com/neo/sevice/UserInfoService.java
浏览文件 @
b8543683
package
com.neo.sevice
;
import
com.neo.
entity
.UserInfo
;
import
com.neo.
model
.UserInfo
;
public
interface
UserInfoService
{
/**通过username查找用户信息;*/
...
...
spring-boot-shiro/src/main/java/com/neo/sevice/impl/UserInfoServiceImpl.java
浏览文件 @
b8543683
package
com.neo.sevice.impl
;
import
com.neo.dao.UserInfoDao
;
import
com.neo.
entity
.UserInfo
;
import
com.neo.
model
.UserInfo
;
import
com.neo.sevice.UserInfoService
;
import
org.springframework.stereotype.Service
;
...
...
spring-boot-shiro/src/main/resources/application.yml
浏览文件 @
b8543683
spring
:
datasource
:
url
:
jdbc:mysql://localhost:3306/test
url
:
jdbc:mysql://localhost:3306/test
?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true
username
:
root
password
:
root
#schema: database/import.sql
#sql-script-encoding: utf-8
driver-class-name
:
com.mysql.jdbc.Driver
driver-class-name
:
com.mysql.
cj.
jdbc.Driver
jpa
:
database
:
mysql
show-sql
:
true
hibernate
:
ddl-auto
:
update
naming
:
strategy
:
org.hibernate.cfg.DefaultComponentSafeNamingStrategy
properties
:
hibernate
:
dialect
:
org.hibernate.dialect.MySQL5Dialect
thymeleaf
:
cache
:
false
mode
:
LEGACYHTML5
\ No newline at end of file
mode
:
HTML
\ No newline at end of file
spring-boot-shiro/src/test/java/com/neo/ShiroApplicationTests.java
0 → 100644
浏览文件 @
b8543683
package
com.neo
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
ShiroApplicationTests
{
@Test
public
void
contextLoads
()
{
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录