Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neo4jRelation
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qiuchaofei
neo4jRelation
Commits
7d2eacc4
Commit
7d2eacc4
authored
Feb 27, 2025
by
mahx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改配置文件
parent
e7f09706
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
101 additions
and
245 deletions
+101
-245
pom.xml
pom.xml
+15
-20
logback-custom.xml
src/assembly/bin/logback-custom.xml
+0
-0
startup.sh
src/assembly/bin/startup.sh
+0
-0
server-dist.xml
src/assembly/server-dist.xml
+7
-7
MetadataRelationApplication.java
...etadata/metadataRelation/MetadataRelationApplication.java
+17
-2
Swagger2Config.java
...m/keymobile/metadata/metadataRelation/Swagger2Config.java
+0
-37
FeignClientConfig.java
...e/metadata/metadataRelation/config/FeignClientConfig.java
+0
-22
MongoDBConfig.java
...obile/metadata/metadataRelation/config/MongoDBConfig.java
+0
-80
RedisSecurity.java
...obile/metadata/metadataRelation/config/RedisSecurity.java
+0
-15
SecurityConfig.java
...bile/metadata/metadataRelation/config/SecurityConfig.java
+0
-60
application-default.yml
src/main/resources/application-default.yml
+43
-0
application.yml
src/main/resources/application.yml
+19
-2
No files found.
pom.xml
View file @
7d2eacc4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<groupId>
com.keymobile
</groupId>
<groupId>
com.keymobile
</groupId>
<artifactId>
relationNeo4j
</artifactId>
<artifactId>
relationNeo4j
</artifactId>
<version>
1.0.1-SNAPSHOT
</version>
<version>
product-v2-1.0.0-rc1
</version>
<packaging>
jar
</packaging>
<packaging>
jar
</packaging>
<name>
relationNeo4j
</name>
<name>
relationNeo4j
</name>
...
@@ -14,11 +14,11 @@
...
@@ -14,11 +14,11 @@
<parent>
<parent>
<groupId>
com.keymobile
</groupId>
<groupId>
com.keymobile
</groupId>
<artifactId>
parent
</artifactId>
<artifactId>
parent
</artifactId>
<version>
1.1.8-release
</version>
<version>
product-v1-1.0.4-rc1
</version>
</parent>
</parent>
<properties>
<properties>
<auth.version>
4.0.9-beta
</auth.version>
<auth.version>
product-v2-1.0.3-rc1
</auth.version>
</properties>
</properties>
<dependencies>
<dependencies>
...
@@ -31,21 +31,25 @@
...
@@ -31,21 +31,25 @@
<artifactId>
crypto
</artifactId>
<artifactId>
crypto
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.keymobile.auth
</groupId>
<groupId>
com.keymobile.auth
service
</groupId>
<artifactId>
common
</artifactId>
<artifactId>
common
</artifactId>
<version>
${auth.version}
</version>
<version>
${auth.version}
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.keymobile.auth
</groupId>
<groupId>
com.keymobile.auth
service
</groupId>
<artifactId>
security
</artifactId>
<artifactId>
security
</artifactId>
<version>
${auth.version}
</version>
<version>
${auth.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.keymobile.authservice
</groupId>
<artifactId>
component
</artifactId>
<version>
${auth.version}
</version>
</dependency>
<!-- 添加neo4j的jar包 -->
<!-- 添加neo4j的jar包 -->
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-neo4j
</artifactId>
<artifactId>
spring-boot-starter-data-neo4j
</artifactId>
<version>
2.0.4.RELEASE
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.neo4j
</groupId>
<groupId>
org.neo4j
</groupId>
...
@@ -93,14 +97,9 @@
...
@@ -93,14 +97,9 @@
<dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<groupId>
org.springdoc
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<artifactId>
springdoc-openapi-starter-webmvc-ui
</artifactId>
<version>
2.6.1
</version>
<version>
2.0.3
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.6.1
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
@@ -144,10 +143,6 @@
...
@@ -144,10 +143,6 @@
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
<artifactId>
spring-cloud-starter-openfeign
</artifactId>
</dependency>
</dependency>
...
@@ -164,12 +159,12 @@
...
@@ -164,12 +159,12 @@
<dependency>
<dependency>
<groupId>
com.keymobile
</groupId>
<groupId>
com.keymobile
</groupId>
<artifactId>
config
</artifactId>
<artifactId>
config
</artifactId>
<version>
1.1.8-release
</version>
<version>
${parent.version}
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.keymobile
</groupId>
<groupId>
com.keymobile
</groupId>
<artifactId>
crypto
</artifactId>
<artifactId>
crypto
</artifactId>
<version>
1.1.8-release
</version>
<version>
${parent.version}
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
src/
kits
/logback-custom.xml
→
src/
assembly/bin
/logback-custom.xml
View file @
7d2eacc4
File moved
src/
kits
/startup.sh
→
src/
assembly/bin
/startup.sh
View file @
7d2eacc4
File moved
src/assembly/server-dist.xml
View file @
7d2eacc4
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
<fileSets>
<fileSets>
<fileSet>
<fileSet>
<directory>
src/kits
</directory>
<directory>
${project.basedir}/assembly/bin
</directory>
<outputDirectory>
${file.separator}
bin
</outputDirectory>
<outputDirectory>
bin
</outputDirectory>
<includes>
<includes>
<include>
**/*.sh
</include>
<include>
**/*.sh
</include>
</includes>
</includes>
...
@@ -19,8 +19,8 @@
...
@@ -19,8 +19,8 @@
</fileSet>
</fileSet>
<fileSet>
<fileSet>
<directory>
src/kit
s
</directory>
<directory>
${project.basedir}/main/resource
s
</directory>
<outputDirectory>
${file.separator}
config
</outputDirectory>
<outputDirectory>
config
</outputDirectory>
<includes>
<includes>
<include>
**/*.xml
</include>
<include>
**/*.xml
</include>
</includes>
</includes>
...
@@ -28,10 +28,10 @@
...
@@ -28,10 +28,10 @@
</fileSet>
</fileSet>
<fileSet>
<fileSet>
<directory>
${
user.
dir}/target
</directory>
<directory>
${
project.base
dir}/target
</directory>
<outputDirectory>
${file.separator}
lib
</outputDirectory>
<outputDirectory>
lib
</outputDirectory>
<includes>
<includes>
<include>
*.jar
</include>
<include>
*
*/*
.jar
</include>
</includes>
</includes>
<fileMode>
755
</fileMode>
<fileMode>
755
</fileMode>
</fileSet>
</fileSet>
...
...
src/main/java/com/keymobile/metadata/metadataRelation/MetadataRelationApplication.java
View file @
7d2eacc4
...
@@ -9,11 +9,18 @@ import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
...
@@ -9,11 +9,18 @@ import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@EnableScheduling
@EnableScheduling
@EnableFeignClients
@EnableFeignClients
@SpringBootApplication
@SpringBootApplication
@ComponentScan
(
basePackages
={
"com.keymobile.metadataRelation"
,
"com.keymobile.config.logging"
,
"com.keymobile.config.naming"
,
"com.keymobile.config.feignclient"
,
"com.keymobile.config.redisclient"
,
"com.keymobile.authservice.component"
})
@PropertySource
(
value
=
"classpath:/application.yml"
)
public
class
MetadataRelationApplication
{
public
class
MetadataRelationApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
@@ -26,12 +33,20 @@ public class MetadataRelationApplication {
...
@@ -26,12 +33,20 @@ public class MetadataRelationApplication {
return
new
StringEncryptor
()
{
return
new
StringEncryptor
()
{
@Override
@Override
public
String
encrypt
(
String
s
)
{
public
String
encrypt
(
String
s
)
{
return
ApplicationHelper
.
getEncryptor
().
encrypt
(
s
);
try
{
return
ApplicationHelper
.
getEncryptor
().
encrypt
(
s
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
@Override
@Override
public
String
decrypt
(
String
s
)
{
public
String
decrypt
(
String
s
)
{
return
ApplicationHelper
.
getEncryptor
().
decrypt
(
s
);
try
{
return
ApplicationHelper
.
getEncryptor
().
decrypt
(
s
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
};
};
}
}
...
...
src/main/java/com/keymobile/metadata/metadataRelation/Swagger2Config.java
deleted
100644 → 0
View file @
e7f09706
package
com
.
keymobile
.
metadata
.
metadataRelation
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@Configuration
@EnableSwagger2
public
class
Swagger2Config
{
@Bean
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.keymobile.metadata.metadataRelation"
))
.
paths
(
PathSelectors
.
any
())
.
build
();
}
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
"DATA MODEL RESTful APIs"
)
.
description
(
"Spring Boot Swagger2"
)
.
termsOfServiceUrl
(
"http://www.keymobile.com.cn/"
)
.
contact
(
"keymobile"
)
.
version
(
"1.0"
)
.
build
();
}
}
src/main/java/com/keymobile/metadata/metadataRelation/config/FeignClientConfig.java
deleted
100644 → 0
View file @
e7f09706
package
com
.
keymobile
.
metadata
.
metadataRelation
.
config
;
import
feign.auth.BasicAuthRequestInterceptor
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
FeignClientConfig
{
@Value
(
"${security.authUser}"
)
private
String
authUser
;
@Value
(
"${security.authPwd}"
)
private
String
authPwd
;
@Bean
public
BasicAuthRequestInterceptor
getBasicAuthRequestInterceptor
()
{
return
new
BasicAuthRequestInterceptor
(
authUser
,
authPwd
);
}
}
\ No newline at end of file
src/main/java/com/keymobile/metadata/metadataRelation/config/MongoDBConfig.java
deleted
100644 → 0
View file @
e7f09706
package
com
.
keymobile
.
metadata
.
metadataRelation
.
config
;
import
com.mongodb.*
;
import
com.mongodb.client.MongoDatabase
;
import
com.mongodb.client.gridfs.GridFSBucket
;
import
com.mongodb.client.gridfs.GridFSBuckets
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.mongodb.MongoDbFactory
;
import
org.springframework.data.mongodb.config.AbstractMongoConfiguration
;
import
org.springframework.data.mongodb.core.SimpleMongoDbFactory
;
import
org.springframework.data.mongodb.gridfs.GridFsTemplate
;
import
java.util.ArrayList
;
import
java.util.List
;
@Configuration
public
class
MongoDBConfig
extends
AbstractMongoConfiguration
{
@Value
(
"${mongodb.uri}"
)
private
String
host
;
@Value
(
"${mongodb.database}"
)
private
String
database
;
@Value
(
"${mongodb.username}"
)
private
String
user
;
@Value
(
"${mongodb.password}"
)
private
String
pswd
;
@Value
(
"${mongodb.maxConnectionIdleTime}"
)
private
Integer
maxConnectionIdleTime
=
60000
;
@Override
protected
String
getDatabaseName
()
{
return
database
;
}
@Bean
@Override
public
MongoDbFactory
mongoDbFactory
()
{
return
new
SimpleMongoDbFactory
(
this
.
mongoClient
(),
this
.
getDatabaseName
());
}
@Bean
public
GridFsTemplate
gridFsTemplate
()
throws
Exception
{
return
new
GridFsTemplate
(
mongoDbFactory
(),
mappingMongoConverter
());
}
@Bean
public
GridFSBucket
getGridFSBuckets
()
{
MongoDatabase
db
=
mongoDbFactory
().
getDb
();
return
GridFSBuckets
.
create
(
db
);
}
@Override
public
MongoClient
mongoClient
()
{
if
(
host
.
split
(
","
).
length
>
1
)
{
String
[]
serverArray
=
host
.
split
(
","
);
List
<
ServerAddress
>
serverList
=
new
ArrayList
<>();
for
(
String
ipPort
:
serverArray
)
{
String
[]
ipAndPort
=
ipPort
.
split
(
":"
);
serverList
.
add
(
new
ServerAddress
(
ipAndPort
[
0
].
trim
(),
Integer
.
valueOf
(
ipAndPort
[
1
])));
}
MongoClientOptions
options
=
MongoClientOptions
.
builder
()
.
maxConnectionIdleTime
(
maxConnectionIdleTime
)
.
readPreference
(
ReadPreference
.
secondaryPreferred
()).
build
();
MongoCredential
credential
=
MongoCredential
.
createCredential
(
user
,
database
,
pswd
.
toCharArray
());
return
new
MongoClient
(
serverList
,
credential
,
options
);
}
else
{
String
uri
=
String
.
format
(
"mongodb://%s:%s@%s/%s"
,
user
,
pswd
,
host
,
database
);
MongoClientOptions
.
Builder
builder
=
new
MongoClientOptions
.
Builder
();
builder
.
maxConnectionIdleTime
(
maxConnectionIdleTime
);
MongoClientURI
clientURI
=
new
MongoClientURI
(
uri
,
builder
);
return
new
MongoClient
(
clientURI
);
}
}
}
src/main/java/com/keymobile/metadata/metadataRelation/config/RedisSecurity.java
deleted
100644 → 0
View file @
e7f09706
package
com
.
keymobile
.
metadata
.
metadataRelation
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.session.data.redis.config.ConfigureRedisAction
;
@Configuration
class
RedisSecurity
{
@Bean
public
static
ConfigureRedisAction
configureRedisAction
()
{
return
ConfigureRedisAction
.
NO_OP
;
}
}
src/main/java/com/keymobile/metadata/metadataRelation/config/SecurityConfig.java
deleted
100644 → 0
View file @
e7f09706
package
com
.
keymobile
.
metadata
.
metadataRelation
.
config
;
import
com.keymobile.auth.common.security.CustomizedUserDetailService
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity
(
prePostEnabled
=
true
)
@ComponentScan
(
"com.keymobile.auth.common.security"
)
public
class
SecurityConfig
extends
WebSecurityConfigurerAdapter
{
@Autowired
private
CustomizedUserDetailService
customUserDetailService
;
@Value
(
"${security.permit}"
)
private
boolean
permit
=
true
;
@Autowired
public
void
configure
(
AuthenticationManagerBuilder
auth
)
throws
Exception
{
auth
.
userDetailsService
(
customUserDetailService
).
passwordEncoder
(
new
SHA1PasswordEncoder
());
}
@Override
protected
void
configure
(
HttpSecurity
http
)
throws
Exception
{
if
(
permit
)
{
http
.
httpBasic
().
and
().
authorizeRequests
().
anyRequest
().
permitAll
();
}
else
{
http
.
httpBasic
().
and
()
.
authorizeRequests
().
antMatchers
(
"/actuator/**"
).
permitAll
().
and
()
.
authorizeRequests
().
anyRequest
().
authenticated
();
}
http
.
csrf
().
disable
();
}
class
SHA1PasswordEncoder
implements
PasswordEncoder
{
@Override
public
String
encode
(
CharSequence
charSequence
)
{
return
DigestUtils
.
sha1Hex
(
charSequence
.
toString
());
}
@Override
public
boolean
matches
(
CharSequence
charSequence
,
String
s
)
{
return
DigestUtils
.
sha1Hex
(
charSequence
.
toString
()).
equals
(
s
);
}
}
}
src/main/resources/application-default.yml
0 → 100644
View file @
7d2eacc4
spring
:
session
:
redis
:
namespace
:
default
elasticsearch
:
uris
:
http://es0:29200
data
:
redis
:
host
:
redis0
port
:
6379
password
:
password0
mongodb
:
host
:
mongo0
port
:
27017
database
:
d0
username
:
user0
password
:
password0
neo4j
:
uri
:
http://192.168.0.143:7474
url
:
bolt://192.168.0.143:7687
username
:
neo4j
password
:
yuanyao
datasource
:
hikari
:
maximum-pool-size
:
5
url
:
jdbc:mysql://mysql0:3306/d0?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useSsl=false
username
:
user0
password
:
password0
rabbitmq
:
host
:
mq0
port
:
5672
username
:
user0
password
:
password0
virtual-host
:
v0
eureka
:
client
:
registryFetchIntervalSeconds
:
5
region
:
default
serviceUrl
:
defaultZone
:
http://e0:8081/eureka/
enabled
:
true
\ No newline at end of file
src/main/resources/application.yml
View file @
7d2eacc4
server
:
port
:
8289
spring
:
main
:
allow-bean-definition-overriding
:
true
allow-circular-references
:
true
application
:
name
:
metadataRelation
profiles
:
active
:
default
management
:
management
:
metrics
:
metrics
:
tags
:
tags
:
...
@@ -7,4 +19,9 @@ management:
...
@@ -7,4 +19,9 @@ management:
show-details
:
always
show-details
:
always
web
:
web
:
exposure
:
exposure
:
include
:
prometheus
include
:
prometheus
\ No newline at end of file
logging
:
level
:
root
:
info
config
:
classpath:logback-custom.xml
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment