Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
bpframework
Advanced tools
This project is still in development
use cli to create a project.
npm i bpframework-cli -g
create a project.
bpframework init
see directory ./examples
feature | supports |
---|---|
config | bootstrap.yml SpringCloudConfig |
discovery | nacos |
scheduling | @Scheduled |
api routers | @RestController |
The appropriate configuration is required to enable the corresponding feature: config
name | description |
---|---|
FindMicroserviceConfigure | 定义自定义的服务发现处理方法 |
FeignClientConfigure | 定义FeignClient的默认headers等信息 |
RestControllerConfigure | 定义RestController的默认headers等信息 |
By default, nacos is used to find micro-service; You can customize it by @FindMicroserviceConfigure
.
@Service()
class Configure {
@FindMicroserviceConfigure
async onFindMicroservice(serviceName: string, excludeHost: string): Promise<ServiceInfo> {
return {
ip,
port,
serviceName,
metadata,
}
}
}
定义RestController的默认headers等信息, 使用如下方式.
@Service()
class Configure {
@RestControllerConfigure
onConfigure(): bp.RestControllerConfigureInfo {
return {
defaultHeaders: {'content-type': 'application/json;charset=utf-8'},
}
}
}
定义FeignClient的默认headers等信息, 使用如下方式.
@Service()
class Configure {
@FeignClientConfigure
onConfigure(): bp.FeignClientConfigureInfo {
return {
defaultHeaders: {'content-type': 'application/json;charset=utf-8'},
/**
* 对每次请求后接收的消息进行过滤.
*/
filterResponseCallback: (data: FeignClientFilterResponseData) => {
},
/**
* Processing the data of the request.
*/
filterRequestCallback: (data: FeignClientFilterRequestData, feignData: FeignDataType) => {
}
}
}
}
使用 @Value 注解设置初始值或获取配置值.
@Service()
class Demo {
@Value("Miss A")
teacher1Name: string; // will set to 'Miss A'
@Value("${teacherName2}")
teacher2Name: string; // will set to config value "teacherName2"
@Value("${teacherName3:defaultName}")
teacher3Name: string; // will set to 'defaultName' if config value "teacherName3" isn't existed.
}
see https://github.com/bpcloud/middleware.git
name | description |
---|---|
ContextRefreshedEventListener | 本地配置加载完成, 系统service对象初始化完成 |
RefreshRemoteEventListener | 远程配置动态刷新事件 |
InstanceRegisteredEventListener | 实例注册到注册中心后的事件 |
本地配置加载完成, 系统service对象初始化完成.
@Service()
class ApplicationEvent {
@ContextRefreshedEventListener
async onContextRefreshed(ev:ContextRefreshedEvent):void {
}
}
远程配置动态刷新事件.
@Service()
class ApplicationEvent {
@RefreshRemoteEventListener
async onRefreshRemote(ev:RefreshRemoteEvent):void {
}
}
实例注册到注册中心后的事件.
@Service()
class ApplicationEvent {
@InstanceRegisteredEventListener
async onInstanceRegistered(ev:InstanceRegisteredEvent):void {
}
}
使用此注解可以开启一个定时任务.
@Service()
class Demo {
@Scheduled({cron:'* * * * * *'})
async onTick(): Promise<false|void> {
return false; // 返回false则表明停止此task.
}
}
FAQs
Web framework like java springboot and springcloud
The npm package bpframework receives a total of 6 weekly downloads. As such, bpframework popularity was classified as not popular.
We found that bpframework demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.