我正在使用Hibernate和Spring Security在Spring MVC 4 中创建一个项目。在这个项目中,我有 3 个角色:,和.ROLE_USERROLE_COMPANYROLE_ADMIN
用户将像常规注册站点一样注册,但我对如何通过注册过程在数据库中保存新用户、如何保存Spring Security定义的新用户和数据库以及如何使用 hibernate 获取该信息感到困惑。
谢谢你。
注意:我发现本文在实现期间无法在打字稿中找到OnInit,但是下面的代码已经导入了OnInit/ OnDestroy。
我发现的所有示例(例如,使用Route Parameters)都指示在类定义中添加implements OnInit/ OnDestroy子句,并在预订时从路由中获取参数时包括了ngOnInit/ ngOnDestroy方法-代码正在执行此操作。
但是,VS2017报告该子句错误“错误地实现OnInit / OnDestroy”,并报告该函数错误“无法找到ngOnInit / ngOnDestroy”。
如果删除该implements子句并注释ngOnInit/ ngOnDestroy函数(仅将代码保留在的主体中ngOnInit),则该代码有效;成功从路由参数中获取参数。
import { Component, Inject, OnInit, OnDestroy } from '@angular/core';
import { Http } from '@angular/http';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'submission',
templateUrl: './submission.component.html'
})
export class SubmissionComponent implements OnInit, OnDestroy {
private baseUrl: string;
private http: Http;
private route: ActivatedRoute;
private sub: any; …Run Code Online (Sandbox Code Playgroud) 我已经用通用方法使用参数对排序算法Quicksort进行了编码:
T[] array, int low, int high)T[] array, int low, int high)但是,当我尝试在排序方法主体中进行递归时,对于array参数,它说
Wrong 1st arguement type. Found: 'T[]', required: 'T[]'
这是排序方法中的代码:
if (low < high)
{ int pi = partition(array, low, high);
Quicksort(array, low, pi-1);
Quicksort(array, pi+1, high);
}
Run Code Online (Sandbox Code Playgroud)
这是分区方法中的代码:
T pivot = array[high];
int i = (low-1); // index of smaller element
for (int j=low; j<high; j++)
{
if (array[j].compareTo(pivot) <=0)
{
i++;
// swap array[i] and array[j]
T temp = …Run Code Online (Sandbox Code Playgroud) 是否有可能获得一个带有序号的枚举?
enum SimpleJackCards {
As(11), König(10), Dame(10), Bube(10), Zehn(10), Neun(9), Acht(8),
Sieben(7), Sechs(6), Fünf(5), Vier(4), Drei(3),Zwei(2), Yolly (1);
private int value;
SimpleJackCards(int val) {
value = val;
}
int getValue (){
return value;
}
}
Run Code Online (Sandbox Code Playgroud)
例如
我想写一个方法,给我一张随机卡片......我会随机化一个整数。
并希望使用生成的序数获取该枚举。
即:序号值0将是枚举As值11。
我可以控制mat-select两个mat-optgroup具有事件处理程序的组(selectionChange)="applicationSelected($event.value, i)。
如何检测从哪个组中选择了选项?
angular ×2
java ×2
algorithm ×1
enums ×1
generics ×1
hibernate ×1
implements ×1
ngondestroy ×1
ngoninit ×1
random ×1
sorting ×1
spring ×1
spring-mvc ×1