feat(asset): 添加 Asset 模块配置和依赖
- 在父 pom.xml 中添加 yudao-module-asset 模块 - 添加 yudao-spring-boot-starter-env 依赖 - 修改 application.yaml 配置(Nacos 配置导入、Bean 覆盖) - 添加 SecurityConfiguration 配置类 - 添加 AssetWebConfiguration 配置类 - 修复启动失败问题
This commit is contained in:
1
pom.xml
1
pom.xml
@@ -17,6 +17,7 @@
|
|||||||
<module>yudao-module-system</module>
|
<module>yudao-module-system</module>
|
||||||
<module>yudao-module-infra</module>
|
<module>yudao-module-infra</module>
|
||||||
<module>yudao-module-bpm</module>
|
<module>yudao-module-bpm</module>
|
||||||
|
<module>yudao-module-asset</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
|
|||||||
@@ -16,6 +16,12 @@
|
|||||||
<url>https://github.com/YunaiV/yudao-cloud</url>
|
<url>https://github.com/YunaiV/yudao-cloud</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- 环境配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-env</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 资产管理 API -->
|
<!-- 资产管理 API -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.cloud</groupId>
|
<groupId>cn.iocoder.cloud</groupId>
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.asset.framework.security.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asset 模块的 Security 配置
|
||||||
|
*/
|
||||||
|
@Configuration("assetSecurityConfiguration")
|
||||||
|
public class SecurityConfiguration {
|
||||||
|
|
||||||
|
@Bean("assetAuthorizeRequestsCustomizer")
|
||||||
|
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
||||||
|
return new AuthorizeRequestsCustomizer() {
|
||||||
|
@Override
|
||||||
|
public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) {
|
||||||
|
// 可以在这里配置需要放行的 URL
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.asset.framework.web.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration;
|
||||||
|
import org.springdoc.core.models.GroupedOpenApi;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asset 模块的 Web 配置
|
||||||
|
*/
|
||||||
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
public class AssetWebConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* asset-server 模块的 API 分组
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi assetGroupedOpenApi() {
|
||||||
|
return YudaoSwaggerAutoConfiguration.buildGroupedOpenApi("asset");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,89 +1,27 @@
|
|||||||
server:
|
|
||||||
port: 48083
|
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: asset-server
|
name: asset-server
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: dev
|
||||||
|
|
||||||
|
# 允许 Bean 覆盖
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
config:
|
||||||
|
import:
|
||||||
|
- optional:nacos:common-dev.yaml
|
||||||
|
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml
|
||||||
|
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
|
server-addr: ${NACOS_ADDR:localhost:8848}
|
||||||
|
namespace: ${NACOS_NAMESPACE:dev}
|
||||||
|
username: ${NACOS_USERNAME:nacos}
|
||||||
|
password: ${NACOS_PASSWORD:nacos}
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 127.0.0.1:8848
|
namespace: ${NACOS_NAMESPACE:dev}
|
||||||
config:
|
config:
|
||||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
namespace: ${NACOS_NAMESPACE:dev}
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
shared-configs:
|
|
||||||
- application-${spring.profiles.active}.yaml
|
|
||||||
|
|
||||||
--- #################### 数据库相关配置 ####################
|
|
||||||
|
|
||||||
spring:
|
|
||||||
datasource:
|
|
||||||
druid:
|
|
||||||
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
|
||||||
username: root
|
|
||||||
password: 123456
|
|
||||||
|
|
||||||
# Redis 配置
|
|
||||||
data:
|
|
||||||
redis:
|
|
||||||
host: 127.0.0.1
|
|
||||||
port: 6379
|
|
||||||
database: 0
|
|
||||||
password:
|
|
||||||
|
|
||||||
--- #################### 定时任务相关配置 ####################
|
|
||||||
|
|
||||||
xxl:
|
|
||||||
job:
|
|
||||||
enabled: false
|
|
||||||
admin:
|
|
||||||
addresses: http://127.0.0.1:9090/xxl-job-admin
|
|
||||||
executor:
|
|
||||||
appname: ${spring.application.name}
|
|
||||||
logpath: ${user.home}/logs/xxl-job/${spring.application.name}
|
|
||||||
accessToken: default_token
|
|
||||||
|
|
||||||
--- #################### 服务保障相关配置 ####################
|
|
||||||
|
|
||||||
# Lock4j 配置项
|
|
||||||
lock4j:
|
|
||||||
acquire-timeout: 3000
|
|
||||||
expire: 30000
|
|
||||||
|
|
||||||
--- #################### 监控相关配置 ####################
|
|
||||||
|
|
||||||
management:
|
|
||||||
endpoints:
|
|
||||||
web:
|
|
||||||
exposure:
|
|
||||||
include: '*'
|
|
||||||
endpoint:
|
|
||||||
health:
|
|
||||||
show-details: ALWAYS
|
|
||||||
|
|
||||||
--- #################### 芋道相关配置 ####################
|
|
||||||
|
|
||||||
yudao:
|
|
||||||
info:
|
|
||||||
version: 1.0.0
|
|
||||||
base-package: cn.iocoder.yudao.module.asset
|
|
||||||
web:
|
|
||||||
admin-api:
|
|
||||||
prefix: /admin-api
|
|
||||||
controller: '**.controller.admin.**'
|
|
||||||
security:
|
|
||||||
permit-all_urls:
|
|
||||||
- /admin-api/asset/truck/page # 车辆分页查询,示例
|
|
||||||
xss:
|
|
||||||
enable: false
|
|
||||||
exclude-urls:
|
|
||||||
- /admin-api/asset/truck/create # 车辆创建,示例
|
|
||||||
access-log:
|
|
||||||
enable: false
|
|
||||||
error-code:
|
|
||||||
enable: false
|
|
||||||
demo: false
|
|
||||||
|
|||||||
Reference in New Issue
Block a user