我想在我的VPS上放一个war文件.但它缺少webapps文件夹.
Tomcat 7在那里,但我正在摸着webapps文件夹的位置.
这是我在服务器上部署war文件的第一次尝试,我只在我的本地完成.
当我找到webapps时,如何将其链接到域?
假设我有一个名为www.foo.com的网站和一个名为software.war的war文件.如何将war文件链接到域?
据我所知,这是正确设置但我收到以下错误:
java.lang.IllegalStateException: Neither BindingResult nor plain target
object for bean name 'person' available as request attribute
Run Code Online (Sandbox Code Playgroud)
形成
<form action="#" th:action="@{/person}" th:object="${person}" method="post" th:required="required">
<input type="text" th:field="*{subject}" class="contact col-md-6" placeholder="Name *" th:required="required"/>
<input type="text" th:field="*{name}" class="contact col-md-6" placeholder="Name *" th:required="required"/>
<input type="text" th:field="*{lastName}" class="contact col-md-6" placeholder="Name *" th:required="required"/>
<input type="email" th:field="*{email}" class="contact noMarr col-md-6" placeholder="E-mail address *" th:required="required"/>
<textarea name="comment" class="contact col-md-12" th:field="*{message}" placeholder="Message *"></textarea>
<input type="submit" id="submit" class="contact submit" value="Send message"/>
</form>
Run Code Online (Sandbox Code Playgroud)
Person.java
public class Person {
private int id; …Run Code Online (Sandbox Code Playgroud) 我与实践@Input和@Output在这里是问题.
在我的家庭组件中,我有以下内容:
<!-- Main Content -->
<div class="container">
<div *ngIf="registered">
<login></login>
</div>
<div *ngIf="!registered">
<register></register>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
registered 位于 HomeComponent.ts
@Component({
selector:'home',
templateUrl:'./home.html',
})
export class HomeComponent {
registered:Boolean = true;
}
Run Code Online (Sandbox Code Playgroud)
我的目标是registered根据按下的内容更改主组件中的值.
如果在导航栏中按下了注册表单,则表单将更改为注册表单,因为其中的值home component已更改.但是,如果按下登录,它会返回.
我把它变得有点复杂,但这是为了学习目的.
在目录中user我有三个模块Login,Register和UserService.UserService imports the components from登录and注册and exports them. I importUserService intoNavigationBar`模块.
在home.html我想要更改表单的页面中,我只是调用<nav-bar></nav-bar>
@NgModule({
imports:[
SmartAdminModule,
UserModule //has Login and …Run Code Online (Sandbox Code Playgroud) 我试图像这样呈现一个模态:
HTML
<div class="btn-holder">
<a (click)="this.open()" class="btn btn-success text-uppercase">Edit My Profile</a>
</div>
Run Code Online (Sandbox Code Playgroud)
模块:
imports: [BrowserModule, HttpModule,
RouterModule.forRoot(appRoutes),
NgbModule.forRoot(),
EditProfileComponent
],
Run Code Online (Sandbox Code Playgroud)
零件:
import {Component} from "@angular/core";
@Component({
selector: 'edit-profile',
templateUrl: './editProfile.html'
})
export class EditProfileComponent{
constructor(){
}
submitForm(){
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我不知道如何让它工作,因为文档含糊不清.建议吗?
我尝试过以下方法:
@Component({
selector: 'edit-profile',
templateUrl: './editProfile.html'
})
export class EditProfileComponent{
closeResult: string;
constructor(private modalService: NgbModal){ }
open(content) {
this.modalService.open(content).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
private getDismissReason(reason: any): string …Run Code Online (Sandbox Code Playgroud) 我有multibuild项目,目前正在设置。每个模块自然都有一个gradle.build仅包含以下内容的文件:
dependencies {
}
Run Code Online (Sandbox Code Playgroud)
在build.gradle我想要的主文件中,每个模块都需要。但是当我做一个gradle build我得到一个错误说:
无法解析外部依赖项org.springframework.boot:spring-boot-starter:,因为未定义存储库。要求:项目:
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'io.spring.dependency-management'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
buildscript {
ext {
springBootVersion = '2.0.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
sourceSets.all { ext.purpose = null }
// Everything in subprojects are applied to all modules
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot' …Run Code Online (Sandbox Code Playgroud) 我正在尝试测试服务,但存储库始终为空。使用 JPA 存储库时,我从未遇到过此问题。我不确定它是否与 ReactiveCrudRepository 有关。有人遇到过这个问题吗?
@RunWith(MockitoJUnitRunner.class)
class UserTest {
@InjectMocks
private UserService underTest;
@Mock
private UserRepository userRepository;
@Mock
private AutoCloseable closeable;
@BeforeEach
public void init() {
closeable = MockitoAnnotations.openMocks(this);
}
@AfterEach
public void closeService() throws Exception {
closeable.close();
}
@Test
void getApplicableUsers() {
when(userRepository.findAll().collectList().block()).thenReturn(new ArrayList<>());
Set<User> expected = underTest.getUsers(getUser(), getUsers());
verify(underTest, times(1)).updateUsers(getUser(),expected);
}
}
Run Code Online (Sandbox Code Playgroud)
> error
>
> java.lang.NullPointerException
> at com.user.UserServiceTest.updateUsers(UserService.java:99)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
> …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建 Jupyter Notebook,但我不断收到错误消息
Constraint constraints/compute.vmExternalIpAccess violated for project <projectID>. Add instance <project> to the constraint to use external IP with it.
Run Code Online (Sandbox Code Playgroud)
我创建了 VPC 网络,笔记本尝试创建自身,但我无法克服该错误。
我正在尽力在这里使用很少甚至没有XML.我做了一个非常简单的程序,但它不起作用.希望有人可以帮助我.
public class App {
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new
AnnotationConfigApplicationContext(Logger.class);
Logger logger = ctx.getBean(Logger.class);
logger.writeConsole("Hello there");
logger.writeFile("Hi again");
ctx.close();
}
}
Run Code Online (Sandbox Code Playgroud)
接口
public interface LogWriter {
public void write(String text);
}
Run Code Online (Sandbox Code Playgroud)
的FileWriter
public class FileWriter implements LogWriter {
public void write(String text) {
System.out.println("FileWriter: " + text);
}
}
Run Code Online (Sandbox Code Playgroud)
ConsoleWriter
public class ConsoleWriter implements LogWriter{
public void write(String text) {
System.out.println("Console Writer: "+text);
}
}
Run Code Online (Sandbox Code Playgroud)
记录仪
public class Logger {
@Autowired
private ConsoleWriter consoleWriter; …Run Code Online (Sandbox Code Playgroud) 我正在学习Angular 2测试,我收到一个目前对我没有意义的错误.
'expect' was used when there was no current spec,
测试:
import {ExperimentsComponent} from "./experiments.component";
import {StateService} from "../common/state.service";
import {ExperimentsService} from "../common/experiments.service";
describe('experiments.component title and body should be correct',() => {
let stateService = StateService;
let experimentService = ExperimentsService;
let app = new ExperimentsComponent(new stateService, new experimentService);
expect(app.title).toBe('Experiments Page');
expect(app.body).toBe('This is the about experiments body');
});
Run Code Online (Sandbox Code Playgroud)
组件:
import {Component, OnInit} from "@angular/core";
import {Experiment} from "../common/experiment.model";
import {ExperimentsService} from "../common/experiments.service";
import {StateService} from "../common/state.service";
@Component({
selector: 'experiments',
template: …Run Code Online (Sandbox Code Playgroud) 我启动了以下两个容器,但卡夫卡说连接被拒绝。
docker run zookeeper和docker run wurstmeister/kafka
我就这样运行它,连接被拒绝。日志中写道:
信息正在打开与服务器 localhost/127.0.0.1:2181 的套接字连接。不会尝试使用 SASL 进行身份验证(未知错误)(org.apache.zookeeper.ClientCnxn)
然后:
警告会话 0x0 服务器为空,意外错误,关闭套接字连接并尝试重新连接(org.apache.zookeeper.ClientCnxn)java.net.ConnectException:连接被拒绝
首先启动了zookeeper,它在2181上启动,当启动kafka时,它会查看2181“zookeeper”,然后对我爆炸。建议?
angular ×3
java ×2
spring-boot ×2
build.gradle ×1
docker ×1
gradle ×1
mockito ×1
ng-bootstrap ×1
spring-mvc ×1
thymeleaf ×1
tomcat ×1
typescript ×1
unit-testing ×1
vps ×1