我担心有人会提出我的问题,但我找不到令人满意的问题(也许是因为我在Angular 2+世界中非常有限,我理解错了).
据我所知,在完成了几个Hello World之后我很难理解,很少有YouTube演示观看:
ng测试:
xxx.compnent.spec.ts
运行,并在浏览器中显示类似于JUnit的最终报告ng e2e:
您在编写嵌套用户事件时编写测试
eg. page.navigateTo();
page.getParagraphText()
.then(msg => expect(msg).toEqual('Welcome to app!!'))
.then(msg => expect(msg).toEqual('xxx'))
.then(done, done.fail);
Run Code Online (Sandbox Code Playgroud)您使用量角器执行端到端测试主要是在部署应用程序后的一种预生产环境
Theoracly说,第二个是特定的端到端,其重点是模拟最终用户完成的整个流程.
希望,直到这里是正确的,我想知道幕后发生了什么真正使他们与众不同.我不想比较哪个更好但是我肯定错过了一些点,因为我使用完全相同的想法创建了一些测试,并且我通过ng测试触发了它.
例如:
...
it('should display the modal when `create Paste` is clicked', () => {
let createPasteButton = fixture.debugElement.query(By.css("button"));
//create a spy on the createPaste method
spyOn(component,"createPaste").and.callThrough();
//triggerEventHandler simulates a click event on the button object
createPasteButton.triggerEventHandler('click',null);
//spy checks whether the method was called
expect(component.createPaste).toHaveBeenCalled();
fixture.detectChanges();
expect(component.showModal).toBeTruthy("showModal should …
Run Code Online (Sandbox Code Playgroud) 我在春天启动的文档阅读(https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-logging.html)
你也可以在application.properties中指定debug = true"
所以我想我可以通过在application.properties中添加debug = false来关闭调试日志.我做到了,但不幸的是它没有用.然后我在同一个文档中阅读
日志记录系统在应用程序生命周期的早期初始化,因此在通过
@PropertySource
注释加载的属性文件中找不到这样的日志记录属性"
和
"由于日志记录在
ApplicationContext
创建之前已初始化,因此无法控制@PropertySources
Spring@Configuration
文件中的日志记录"
和
"如果可能的话,我们建议您使用-Spring变种为您的日志配置"所以我加了一个文件名为
log4j-spring.properties
在src/main/resources
.
在这样的文件中我添加了debug=false
(只有这一行而没有别的)但我仍然看到所有"当前日期"[主要] DEBUG ...消息.所以,我的问题是如何在我的Spring Boot Application中关闭调试消息,因为我将部署到应用程序到生产.有没有推荐的方法通过maven达到这个目的?
*****于2月12日添加
两种主要方法:1)使用AnnotationConfigApplicationContext:
public class DemoAppNoBoot {
public static void main(String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
BatchConfiguration.class);
JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");
Job job = (Job) context.getBean("job");
try {
JobExecution execution = jobLauncher.run(job, new JobParameters());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
片段输出:
08:26:18.713 …
Run Code Online (Sandbox Code Playgroud) 我按照这个例子,它允许发布一个唯一的Person
对象.我想一个REST服务,我可以张贴的集合Person
一次,如列表/名为任何集合Team
众多Person
只在一个通话对象.
我的意思是,我的问题并不完全是关于OneToMany
你在REST请求中发送每个人的关系.本主题很好回答.
我想发送一组Person
利用@RepositoryRestResource
Spring Data Rest的其他功能的对象.这是否可以使用Spring Data Rest或者我应该通过创建控制器来解决,接收列表并解析Team
列表以插入每个Person
?
我发现了这个功能请求,似乎回答说现在Spring Rest Data缺少我想要的东西,但我不确定.
在我的业务需求中,应用程序A会将一个订单列表发布到应用程序B,我必须将其保存在数据库中以供将来处理,因此,在阅读了Spring Data Rest并制作了一些示例后,我发现它的干净架构非常棒且非常适合对于我的要求,除了我没有弄清楚如何发布列表的事实.
我发现了一些主题相似但上下文不同的问题:我可以连接以创建主题,但我无法列出主题,因为我收到了下面提到的错误(据我所知,人们在我进行基本连接时遇到了基本连接问题)我只是为了列出主题列表)。
如果重要,这是我的docker-compose.yml
:
version: "3"
services:
zookeeper:
image: wurstmeister/zookeeper
kafka:
image: wurstmeister/kafka
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: "localhost"
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
Run Code Online (Sandbox Code Playgroud)
我的控制台:
bash-4.4# kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 1 --topic test2
Created topic test2.
bash-4.4# kafka-topics.sh --list --zookeeper localhost:2181
Exception in thread "main" kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
at kafka.zookeeper.ZooKeeperClient.$anonfun$waitUntilConnected$3(ZooKeeperClient.scala:259)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:253)
at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:255)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:113)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1858)
at kafka.admin.TopicCommand$ZookeeperTopicService$.apply(TopicCommand.scala:321)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:54)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
bash-4.4# kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 …
Run Code Online (Sandbox Code Playgroud) 我被困了一个下午,试图在 Android Studio 中再次运行我的小型 Android/Kotlin 应用程序。贴在这个问题主题上的消息突然让我失望。
我做了这些尝试:
1 - 冷启动(在虚拟设备屏幕 > 操作 > 立即冷启动)
2 - 我删除了以前的虚拟设备,然后下载了一个新的(Nexus One)
3 - 我遵循了其他 stackoverflow 答案中的所有步骤
3.1
cd C:\Users\Jimis\AppData\Local\Android\Sdk\platform-tool
adb kill-server
adb.exe start-server
adb devices -l
Run Code Online (Sandbox Code Playgroud)
3.2
删除了平台工具并从SDK Plataform 重新下载了它
3.3
重启电脑
我完全被困住了。
有件事引起了我的注意:为什么有这么多 PID 到端口 5037。请看下面,当我启动 Androdi Studio 时,我只有 3 个,在我尝试调试我的应用程序后,我得到了更多。
Microsoft Windows [versão 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.
C:\Users\Jimis>netstat -ano -p tcp |find "5037"
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 11492
TCP 127.0.0.1:5037 127.0.0.1:50582 ESTABLISHED …
Run Code Online (Sandbox Code Playgroud) android android-emulator android-sdk-2.3 android-sdk-tools android-studio
我正在努力让 Docker LogStash 连接到 Docker ElasticSearch 并启用 xpack 安全性。
主要日志有:
logstash_1 | [2020-05-20T22:41:03,950][WARN ][deprecation.logstash.monitoringextension.pipelineregisterhook] Internal collectors option for Logstash monitoring is deprecated and targeted for removal in the next major version.
logstash_1 | Please configure Metricbeat to monitor Logstash. Documentation can be found at:
logstash_1 | https://www.elastic.co/guide/en/logstash/current/monitoring-with-metricbeat.html
logstash_1 | [2020-05-20T22:41:11,474][INFO ][logstash.licensechecker.licensereader] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://elasticsearch:9200/]}}
logstash_1 | [2020-05-20T22:41:13,084][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :error=>"Got response code '401' contacting …
Run Code Online (Sandbox Code Playgroud) elasticsearch logstash docker docker-compose elasticsearch-x-pack
“...在反应式执行的情况下,如果支持实现是阻塞的,Micronaut Data 将使用配置的 I/O 线程池在不同的线程上调度查询执行。
如果支持实现在驱动程序级别本机支持反应类型,则不使用 I/O 线程池,而是假定驱动程序将以非阻塞方式处理查询......”
我的直接问题:访问关系数据库(例如 PostGres R2DBC 驱动程序)抛出 R2DBC Micronaut Data 是否会依赖 R2DBC 驱动程序以非阻塞方式处理并且更具可扩展性?
假设我的微服务公开了一个基于 ReactiveX 的 Reactive 端点并且必须访问一个阻塞数据源 throw Micronaut Data JDBC(例如,生产版本中还没有 Oracle R2DBC),从上面可以清楚地看出它“将使用配置我/O 线程池”,同时访问数据。我是否完全失去了响应式端点的好处?
这是我与 Micronaut 合作的第一个项目,我有几个采用 Reactive 方法的项目。我远不是反应式最佳实践方面的专家,但我记得我已经阅读了几篇博客:如果您有阻塞源,请避免使用反应式堆栈。我还记得读到过,将非阻塞与阻塞设计混合在一起可能会产生更糟糕的结果,这主要是因为 Eventloop(例如 Netty)的设计方式。由于我将 Micronaut 与 ReactiveX 和关系数据库一起使用,某些情况下使用 R2DBC,而其他情况下使用 JDBC,我将感谢对我的疑问的任何评论。
由于"只有空格返回方法可以注释@Scheduled
",当我使用@Bean
配置而不是xml配置时,如何使用Spring Batch和Spring Scheduler Task ?您可以在下面找到我的完整配置文件.当我从中触发main()
但只有一次时,它运行得很好.我想添加@Scheduled(fixedrate=9999)
以便以特定频率唤起相同的工作.据我所知,为了做到这一点,我被期望添加@Scheduled
step1方法,但我不能,因为它返回与void不同.
@Configuration
@EnableBatchProcessing
@EnableScheduling
public class BatchConfiguration {
private static final Logger log = LoggerFactory
.getLogger(BatchConfiguration.class);
@Bean
@StepScope
public FlatFileItemReader<Person> reader() {
log.info(new Date().toString());
FlatFileItemReader<Person> reader = new FlatFileItemReader<Person>();
reader.setResource(new ClassPathResource("test_person_json.js"));
reader.setLineMapper(new DefaultLineMapper<Person>() {
{
setLineTokenizer(new DelimitedLineTokenizer() {
{
setNames(new String[] {"firstName", "lastName" });
}
});
setFieldSetMapper(new BeanWrapperFieldSetMapper<Person>() {
{
setTargetType(Person.class);
}
});
}
});
return reader;
}
@Bean
public ItemProcessor<Person, Person> processor() {
return new …
Run Code Online (Sandbox Code Playgroud) 我知道有很多类似错误的问题.我希望在重点之前考虑到它只发生在Java 9中.
我确实安装了java 9
C:\_pocs\ws_j9\java9-http-client>java -version
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
C:\_pocs\ws_j9\java9-http-client>echo %JAVA_HOME%
C:\Program Files\Java\jdk-9.0.1
Run Code Online (Sandbox Code Playgroud)
为了简化示例,如果我下载一个非常简单的示例https://examples.javacodegeeks.com/core-java/java-9-httpclient-example/并且我尝试/
mvn clean install package -e
[ERROR] Failed to parse module-info:
[ERROR] With qdox: null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.925 s
[INFO] Finished at: 2018-01-01T23:43:32+01:00
[INFO] Final Memory: 13M/44M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:testCompile (default-testCompile) on project http_client: Execution default-testCompile of …
Run Code Online (Sandbox Code Playgroud) 出于某种未知的原因,每当我gradle clean build
在启动笔记本后运行时,它都会按预期工作。当我第二次尝试时,我总是得到
Unable to delete directory 'C:\_d\mycompany\WSs\demo\build'
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
- C:\_d\mycompany\WSs\demo\build\classes\kotlin\main\com\mybank
- C:\_d\mycompany\WSs\demo\build\classes\kotlin\main\com
- C:\_d\mycompany\WSs\demo\build\classes\kotlin\main
- C:\_d\mycompany\WSs\demo\build\classes\kotlin\test\com
- C:\_d\mycompany\WSs\demo\build\classes\kotlin\test
- C:\_d\mycompany\WSs\demo\build\classes\kotlin
- C:\_d\mycompany\WSs\demo\build\classes
- C:\_d\mycompany\WSs\demo\build\generated\source\kapt
- C:\_d\mycompany\WSs\demo\build\generated\source\kaptKotlin\main
- C:\_d\mycompany\WSs\demo\build\generated\source\kaptKotlin\test
- C:\_d\mycompany\WSs\demo\build\generated\source\kaptKotlin
- C:\_d\mycompany\WSs\demo\build\generated\source
- C:\_d\mycompany\WSs\demo\build\generated
- C:\_d\mycompany\WSs\demo\build\kotlin\compileKotlin\caches-jvm\inputs
- C:\_d\mycompany\WSs\demo\build\kotlin\compileKotlin\caches-jvm\jvm\kotlin
- C:\_d\mycompany\WSs\demo\build\kotlin\compileKotlin\caches-jvm\jvm
- and more ...
New files were found. This might happen because a process …
Run Code Online (Sandbox Code Playgroud) java ×3
spring ×3
docker ×2
micronaut ×2
spring-boot ×2
android ×1
angular ×1
angular-cli ×1
apache-kafka ×1
eclipse ×1
gradle ×1
jasmine ×1
java-9 ×1
kotlin ×1
log4j ×1
logstash ×1
maven ×1
module-info ×1
netty ×1
protractor ×1
r2dbc ×1
reactivex ×1
rest ×1
spring-batch ×1
spring-mvc ×1
windows ×1