Spring Boot 中的新功能。我正在尝试在 Tomcat (8.0.30) 服务器上运行 Spring Boot 应用程序。这是我的pom.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.pr.hotels</groupId>
<artifactId>hotels</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>api-consumer</artifactId>
<packaging>war</packaging>
<name>api-consumer</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.pr</groupId>
<artifactId>amqp</artifactId>
<version>2.1.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions> …
Run Code Online (Sandbox Code Playgroud) 我有一个 Spring Boot 应用程序。一切正常。我只是想了解事务管理器是如何工作的,因为我对我的应用程序有所怀疑。特别是,我对注释有点困惑。
这是Application.java
(主类):
@SpringBootApplication(exclude = ActiveMQAutoConfiguration.class)
@EnableScheduling
public class Application extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure (SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
public static void main(String[] args)
{
SpringApplication.run(Application.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
配置类DataConfig.java
如下所示:
@Configuration
@EnableTransactionManagement
@ComponentScan("com.pr.hotel")
@EnableJpaRepositories("com.pr.hotel")
@PropertySource("classpath:application.properties")
public class DataConfig
{
// code
}
Run Code Online (Sandbox Code Playgroud)
我很担心@EnableTransactionManagement
。这个注释到底是什么意思呢?在这种情况下我应该使用@Transactional
(我不)吗?
我是JavaScript和 JS 框架的新手。我有以下Vuejs代码片段:
<div v-for="coefficient in coefficients" class="coefficient">
<div>
<span class="name">name:{{coefficient.name}}</span>
<span class="value">value:{{coefficient.value}}</span>
<span>---</span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是输出:
name: Ubuntu
value: 1
---
name: MacOS
value: 2
---
name: Windows
value: 3
---
Run Code Online (Sandbox Code Playgroud)
如何排除coefficients
Vuejs的最后一项?
我在JS代码中有这个数组:
var arrOf12Numbers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
Run Code Online (Sandbox Code Playgroud)
我需要将每个数字与之前的数字相加.
var cumulative12ArrOfNumbers = [10, 30, 60, 100, 150, 210, etc to 11 index... ];
Run Code Online (Sandbox Code Playgroud)
JS中最好的方法是什么?
UPD:我是JS的新手