我最近刚刚将我的一个团队 Spring Boot 应用程序从 2.1.3-RELEASE 升级到现在的 2.3.0-RELEASE,并将 Hibernate 版本从 5.3.6.Final 升级到 5.4.15.Final。
一切都很好,但是现在当应用程序在服务器上启动时,它需要 800-900 秒才能启动(大约 15 分钟),而过去只需要大约 30 秒。
需要注意的重要一点是,在 localhost 上运行时,使用 2.1.3 和 2.3.0,应用程序启动是相同的,大约 12-15 秒。
只有部署到服务器时才会遇到启动缓慢的问题。
我确定问题出在新版本的 Spring Boot 上,因为我切换到 SpringBoot 2.1.3 并将 Hibernate 保留为 5.4.15,并且启动速度很快。
那么,在最近的 SpringBoot 版本中是否有一些变化,我必须设置一个属性来禁用某些检查或其他东西?
我看过的大多数文章和帖子都说问题在于 Hibernate 并设置了此属性,spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false但我这样做了,但没有任何效果。
更新:
我尝试了该属性,spring.main.lazy-initialization=true但它对启动性能没有影响。
更新 2:
我从 2.3.0 降级到 2.2.7,这导致平均启动时间为 170 秒,而 2.3.0 的平均启动时间为 800 秒。大约 3 分钟的启动时间仍然很糟糕,但是,除了版本之外没有其他变化的 12 分钟差异,我想知道它是否过于雄心勃勃而无法使用最新版本的 Spring Boot。
如果有人对为什么我们将从 2.1.3 的 30 秒开始时间变为 2.2.7 的 3 分钟开始时间有一些建议,仍然非常好奇。
2.1.x 和 2.2.x …
我正在尝试使用 ngx-mat-select-search 组件在我的应用程序中放置一个带有搜索栏的 mat-select 样式下拉菜单。 https://www.npmjs.com/package/ngx-mat-select-search
我的下拉菜单工作正常,但我试图将其转换为自定义指令,然后我可以在整个应用程序的多个页面上调用和重用该指令。
到目前为止,我有这个: site-dropdown-component.ts
import {AfterViewInit, Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {FormControl} from '@angular/forms';
import {ReplaySubject, Subject} from 'rxjs';
import {MatSelect} from '@angular/material';
import {take, takeUntil} from 'rxjs/operators';
@Component({
selector: 'app-site-dropdown',
template: `
<mat-form-field class="w-100">
<mat-select [formControl]="siteCtrl" placeholder="Site" #singleSelect>
<mat-option>
<ngx-mat-select-search [formControl]="siteFilterCtrl" [placeholderLabel]="'Search Sites...'"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let site of filteredSites | async" [value]="site">{{site.name}}</mat-option>
</mat-select>
</mat-form-field>
`
})
export class SiteDropdownComponent implements OnInit, OnDestroy, AfterViewInit {
/** list of sites */
protected sites: Site[] …Run Code Online (Sandbox Code Playgroud) 我最近在 Angular 6 中做了一个新项目,我之前的所有经验都是在 Angular 1.5 中。
我想根据文本值控制 HTML 页面中项目的背景颜色。
有没有办法专门使用 Angular 方法之类的方法来做到这ngStyle一点,而不仅仅是在组件中编写一个 jQuery 函数来根据值更改 CSS 类?
<span class="producerState">{{prod.producerState}}</span>
Run Code Online (Sandbox Code Playgroud)
.producerState根据文本值更改跨度的背景。
我正在使用 Angular 6,并尝试更改我刚刚使用 chart.js 创建的甜甜圈图的背景颜色。
我一直在关注这里完成的例子:https : //www.js-tutorials.com/angularjs-tutorial/angular-6-chart-tutorial-using-chart-js/
但是,无论我如何尝试更改背景颜色,无论是该示例中显示的方式还是其他方式,颜色始终与库提供的默认颜色相同。
任何人都可以帮助我展示一种方法来覆盖它吗?
组件.html:
<canvas baseChart
[data]="doughnutChartData"
[labels]="doughnutChartLabels"
[chartType]="doughnutChartType"
[options]="doughnutChartOptions"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
Run Code Online (Sandbox Code Playgroud)
组件.ts:
public doughnutChartLabels: string[] = ['Running', 'Paused', 'Stopped'];
public doughnutChartData: number[] = [this.activeProducers, this.pausedProducers, this.invalidProducers];
public doughnutChartType = 'doughnut';
public doughnutChartOptions: any = {
backgroundColor: [
'Red',
'Yellow',
'Blue',
],
responsive: false,
};
Run Code Online (Sandbox Code Playgroud)
我想要的颜色是:
创建了一个stackblitz:https ://stackblitz.com/edit/angular-ctydcu
我有一个Angular 6应用,我正在尝试实现从屏幕右侧滑入的模态窗口,如下所示:https : //codepen.io/anon/pen/OayRVy
但是,无论我做什么尝试,都无法覆盖模式窗口的位置。我唯一能够更改的是标题/正文的背景颜色。
我的模式HTML:
<ng-template #content let-modal="close">
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">Table of Contents</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" (click)="dismissModal(modal)"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
<p>
....
</p>
</div>
</ng-template>
Run Code Online (Sandbox Code Playgroud)
组件代码:
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
constructor(private modalService: NgbModal) {}
public open(content) {
this.modalService.open(content, {ariaLabelledBy: 'modal-basic-title', size: 'lg'}).result.then((result) => {
...
}, (reason) => {
...
});
}
Run Code Online (Sandbox Code Playgroud)
如果我检查HTML并在Chrome DevTools中将float: right属性添加到.modal-dialog容器,它将完成我想要的操作。但是,添加一个
.modal-dialog {
float: right;
}
Run Code Online (Sandbox Code Playgroud)
到我的.scss文件中对该组件无效。
谁能告诉我如何覆盖默认的引导程序样式,以便我可以强制其显示在屏幕的右侧并占据其高度的100%?
angular ×4
typescript ×2
chart.js ×1
charts ×1
components ×1
css ×1
hibernate ×1
java ×1
javascript ×1
jquery ×1
ng-bootstrap ×1
spring ×1
spring-boot ×1