在我的Spring Boot 项目中,我定义了 4 个配置文件
YAML 文件中的属性将在启动期间被 HashiCorp Vault 属性替换。为此,我使用 Spring Cloud Vault 库。在 Spring Boot 2.3.x 中一切正常
当我尝试使用 Spring Cloud Vault 3.0.0-SNAPSHOT 版本将项目升级到 Spring Boot 2.4.0 时,属性没有被替换
引导程序.yml
spring:
cloud:
vault:
authentication: APPROLE
app-role:
role-id: ${role-id}
secret-id: ${secret-id}
role: pres-read
app-role-path: approle
uri: ${vault-server}
connection-timeout: 5000
read-timeout: 15000
kv:
enabled: true
backend: secret
application-name: app/pres
Run Code Online (Sandbox Code Playgroud)
应用程序.yml
spring:
config:
activate:
on-profile: 'demo'
Run Code Online (Sandbox Code Playgroud)
应用程序演示.yml
## Server Properties
server:
port: 8081
spring:
datasource:
username: ${pres.db.username}
password: …Run Code Online (Sandbox Code Playgroud) 我有BookStore Spring Boot项目,需要通过Jenkins进行部署。安装在我的本地计算机(macOS)中的Docker和创建的Jenkinsfile如下
pipeline
{
agent
{
docker
{
image 'maven:3-alpine'
//This exposes application through port 8081 to outside world
args '-u root -p 8081:8081 -v /var/run/docker.sock:/var/run/docker.sock '
}
}
stages
{
stage('Build')
{
steps
{
sh 'mvn -B -DskipTests clean package'
}
}
stage('Test')
{
steps {
//sh 'mvn test'
sh 'echo "test"'
}
post {
always {
//junit 'target/surefire-reports/*.xml'
sh 'echo "test"'
}
}
}
stage('Deliver for development')
{
when {
branch 'development'
}
steps {
sh …Run Code Online (Sandbox Code Playgroud) 我使用 生成了 liquibase 架构mvn liquibase:generateChangeLog,当我尝试使用 执行 diff 命令时,mvn liquibase:diff收到错误消息 Error getting default schema java.lang.NullPointerException。不确定我的配置有什么问题。我正在使用 Spring Boot 和 Spring JPA 测试 Liquibase 3.6
mvn liquibase:diff
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com:liquibasetest >--------------------------
[INFO] Building liquibasetest 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- liquibase-maven-plugin:3.6.3:diff (default-cli) @ liquibasetest ---
[INFO] ------------------------------------------------------------------------
[INFO] Parsing Liquibase Properties File
[INFO] File: src/main/resources/liquibase.properties
[INFO] 'outputChangeLogFile' in properties file is not being used by this task.
[INFO] ------------------------------------------------------------------------
[INFO] …Run Code Online (Sandbox Code Playgroud) 我正在使用ngx-cookie-service包来存储一些与我的应用程序相关的数据。我需要将此 cookie 保存在基本路径上'/',因此每次我都确切地知道如何检索它。我的这个 cookie 需要更新,当发生这种情况时,新的 cookie 必须存储在相同的路径中(所以在 中'/')。问题是,有时当我刷新页面时,新的 cookie 会保存在新路径中,因此当我尝试用它检索它时this.cookieService.get(cookieName, '/')显然会失败。尽管我明确声明使用'/'as path ,但还是会发生这种情况。它并不总是发生,这会导致调试更加困难。
这是我使用cookies的服务
const urlParamsCookieName = 'errepiuapp-url-params';
/**
* This service keeps track of the keys used to retrieve objects from the backend.
*/
@Injectable({
providedIn: 'root'
})
export class KeyLookupService {
private _lookupUrlSegments = ['students', 'macro', 'lto', 'sto', 'reports'];
private _paramsMap$: BehaviorSubject<Map<string, any>>;
private get paramsMap() {
return this._paramsMap$.getValue()
}
constructor(
private cookieService: CookieService,
private router: …Run Code Online (Sandbox Code Playgroud) cookies setcookie angular-cookies angular ngx-cookie-service
在我的 Angular 7 项目中,我有一个带有select和*ngFor块的反应形式。ngFor 值根据从选项中选择的值进行过滤,自定义管道负责过滤。每当我从选项中选择一个值时,我看到的都是"[object Object]"输出。我试过了(ngModelChange)=fun(),change事件。他们没有工作。
形式:
<div class="container container-fluid">
<h3 style="text-align: center"> BCMC CyberSecurity Jobs</h3>
<form [formGroup]="jobsForm">
<div class="row" style="margin-top: 40px">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<label> Job Type:
<select class="custom-select" formControlName="jobTypeControl" (ngModelChange)="updateFilterValue($event)">
<option *ngFor="let jobType of jobTypeObservable" [value]="jobType"> {{jobType.name}}</option>
</select>
</label>
</div>
<div *ngIf="jobsDataAvailable()" class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<div class="has-text-centered">
<pagination-controls (pageChange)="page = $event" class="my-pagination" directionLinks="true" maxSize="5"
nextLabel="" previousLabel=""></pagination-controls>
</div>
</div>
</div>
<div *ngIf="jobsDataAvailable()">
<div *ngFor="let job …Run Code Online (Sandbox Code Playgroud) 当我打开app.e2e-spec.ts时,我通过 Angular 7.2.1 生成了一个新项目,看到TS2304: Cannot find name 'describe'错误。当我单击建议从模块“jasmine”导入描述时,我看到不同的错误TS2305:模块“/Users/pjadda/IdeaProjects/CyberJobs/frontend/src/main/frontend/node_modules/@types/jasmine/index”' 没有导出成员“描述”。
不知道这里出了什么问题。这是通过 Angular CLI 生成的新项目。
应用程序.e2e-规范.ts
import {AppPage} from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to cyber-jobs!');
});
});
Run Code Online (Sandbox Code Playgroud)
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
], …Run Code Online (Sandbox Code Playgroud) 在我的 Spring Boot(数据)项目中,我尝试设置和使用多个数据库。一个数据库是MySql,另一个数据库是H2。我定义了自定义 JPA 配置,如下所示。在应用程序启动期间我遇到异常
没有名为 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' 的 bean 可用异常发生
我尝试按照 Baeldung博客的说明进行操作。
异常日志:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationAvailability' defined in class path resource [org/springframework/boot/autoconfigure/availability/ApplicationAvailabilityAutoConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' availableorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationAvailability' defined in class path resource [org/springframework/boot/autoconfigure/availability/ApplicationAvailabilityAutoConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用KTable来消费来自Kafka主题的事件.但是,它什么也没有回报.当我使用KStream时,它返回并打印对象.这真的很奇怪.制片人和消费者可以在这里找到
//Not working
KTable<String, Customer> customerKTable = streamsBuilder.table("customer", Consumed.with(Serdes.String(), customerSerde),Materialized.<String, Customer, KeyValueStore<Bytes, byte[]>>as(customerStateStore.name()));
customerKTable.foreach(((key, value) -> System.out.println("Customer from Topic: " + value)));
//KStream working
KStream<String, Customer> customerKStream= streamsBuilder.stream("customer", Consumed.with(Serdes.String(), customerSerde));
customerKStream.foreach(((key, value) -> System.out.println("Customer from Topic: " + value)))
Run Code Online (Sandbox Code Playgroud) 我有一个包含3个部分的国家,地区,家庭的Angular项目。加载主页时,我有到的路由设置HomeComponent,该路由具有超链接。一切正常,并且表现得像单页(SPA)。现在,我想添加一个静态HTML页面并路由到它。我查看了Angular Route文档,找不到解决方法。这是我的问题
app-routing.module.ts Github仓库:SpringTestingUI
我想在创建 cookie 时在我的 cookie 中设置安全标志。我想我有解决方案,但我想确定以继续。我使用ngx-cookie-service来设置我的 cookie。
这是我的代码:
const now = new Date();
now.setHours(now.getHours() + 8);
const secureFlag = true;
this.cookieService.set('usertype', 'agent', now, '/', '/', secureFlag);
Run Code Online (Sandbox Code Playgroud)
问题是我不知道是否必须像这样声明第 4 个和第 5 个参数,因为如果我不声明它们会显示错误。
例如我试试这个:
const now = new Date();
now.setHours(now.getHours() + 8);
const secureFlag = true;
this.cookieService.set('usertype', 'agent', now, secureFlag);
Run Code Online (Sandbox Code Playgroud)
它警告我 Argument of type 'true' is not assignable to parameter of type 'string'
当我不想定义它们时,是否必须使用'/'forpath和domain参数?
angular ×5
angular7 ×2
cookies ×2
java ×2
spring-boot ×2
docker ×1
hibernate ×1
jenkins ×1
liquibase ×1
setcookie ×1
spring ×1
spring-cloud ×1
spring-data ×1