最近我一直在研究一段时间前开发的项目的一些改进,这就是我发现的.pom文件中的许多依赖项没有指定版本,但它们已被解析.该项目由1个根模块和2个子模块组成.使用聚合器模式,这意味着根本没有dependencyManagement部分.上层项目简单地聚合了2个模块,这就是它所做的一切.子项目不会将其称为父项.他们有不同的父母.我无法理解的是既没有子项目本身也没有它们的父项(事实上,它也没有依赖管理)为某些依赖项指定了版本.例如:
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>imap</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗?maven是否使用某种默认策略处理版本控制?什么是默认策略?
Spring有一个名为spring IO http://platform.spring.io/platform/的新项目,并不清楚该项目和Spring Boot之间有什么区别.
我已经是一个春季启动用户,但无法判断我是应该使用SpringIO还是继续使用Spring Boot.
如果我只是唱Spring Boot并忽略Spring IO,我会错过什么吗?
我已经阅读了Spring IO的文档,但上述问题的答案仍然不清楚.
我目前正在查看 spring-boot,但无法访问构建中的 repo.spring.io maven 存储库。
我已经创建了初始 Gradle 构建文件,但是当我第一次尝试运行构建时收到 401(未经授权)响应。我试过手动拉下 POM/JAR(手动部署到我的本地存储库),但再次收到 401。
如果我浏览到相关的文件夹,然后单击JAR(POMS似乎是OK),我这里收到一个401错误太(回应是:The server http://repo.spring.io:80 requires a username and password. The server says: Artifactory Realm)
有人可以将我定向到我可以从中提取这些文件的存储库吗?或者,有人可以指导我到哪里可以获得此 repo 的凭据吗?
谢谢
我有一个用作春豆的课程.bean的定义applicationContext.xml如下:
<bean id="myClass" class="com.example.MyClass">
<property name="cssFiles" value="classpath*:../../cssDir/*.css"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
而且MyClass样子:
...
import org.springframework.core.io.Resource;
...
public class MyClass {
private List<Resource> cssFiles;
// methods etc.
}
Run Code Online (Sandbox Code Playgroud)
所以Spring用"classpath*:../../ cssDir /"下的所有扩展名为.css的文件填充cssFiles字段.
现在我正在努力转向完整的注释配置,但我无法用注释做同样的事情.这不起作用:
...
import org.springframework.core.io.Resource;
...
@Component
public class MyClass {
@Value("classpath*:../../cssDir/*.css")
private List<Resource> cssFiles;
// methods etc.
}
Run Code Online (Sandbox Code Playgroud)
你有什么主意吗?
java spring dependency-injection spring-annotations spring-io
我们目前正面临Spring webFlux的性能问题。为了确定反应式编程的好处,我们实现了Spring Boot服务,该服务从MongoDB中获取数据,并通过REST API将其返回给使用者。
该服务有两种变体:
在这两种实现中,REST控制器都直接从存储库中获取数据,并将其作为List resp返回。作为助焊剂。不再执行任何应用程序逻辑。
我们对100个调用该服务的用户进行了小规模的负载/性能测试,我们发现非反应式实施的性能远好于反应式实施。
事实上,不仅非反应式实现具有更好的HTTP吞吐量,而且也许更有趣的是,与反应式实现相比,它消耗更少的CPU和更少的线程!这与预期特别相反,因为我们预计反应式版本会以少量线程扩展,如https://spring.io/blog/2016/07/28/reactive-programming-with-spring-5-0中所述-m1
我们需要在设置中进行一些调整吗?
有人遇到过类似的问题吗?
I'm working on a gradle based spring boot project which downloads some dependencies from 'repo.spring.io'. The application used to work fine a while back but now I'm seeing an error in the download dependencies stage.
When the application goes on to download https://repo.spring.io/libs-milestone/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar, I receive an error with HTTP response code 401(Unauthorized).
我不确定 repo.spring.io 端最近是否有一些变化,因为这以前在我的应用程序上运行没有任何问题。
这是我得到的确切错误以供参考-
What went wrong:
19:44:19 A problem occurred configuring project ':account_settings-service'.
19:44:19 > Could not resolve all files for configuration ':account_settings-service:classpath'.
19:44:19 > Could …Run Code Online (Sandbox Code Playgroud)由于春季IO平台是intruduced我们管理使用Spring IO我们的项目依赖于平台的BOM.因此,我们不再为单个Spring组件(甚至平台库)指定专用版本(我们在覆盖它们时要谨慎).
这个解决方案的缺点是,我们不能像推荐的那样使用新版本的单个组件,例如(昨天)宣布的Spring Framework 4.1.6版本,直到它被集成到新版本的Spring IO平台中.
很高兴了解有关Spring IO平台的发布管理的更多信息.是否有一个总体计划何时发布新版本?我认为实际上新版本的Spring Framework会触发一个新版本的Spring IO平台,但情况似乎并非如此(没有Spring Framework 4.1.5的新版本,我想下一个版本将包括Spring Framework 4.1.6).
有关Spring IO平台发布管理的任何见解对我来说都很有意义,也很有帮助.
我正在关注这个简单的教程http://beanio.org/
最后说你可以使用带注释的类而不是XML文件.我这样做,在我的factory.load()传递值与我的注释类的名称.我得到了org.xml.sax.SAXParseException.我相信这是因为它期待一个XML文件.
我需要使用什么方法来传递带注释的类而不是XML?
所以这build.gradle似乎工作正常
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE')
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName = 'entity-api'
version = '0.1.0-SNAPSHOT'
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
compile('org.springframework.data:spring-data-commons')
testCompile('junit:junit')
testCompile('org.mockito:mockito-core')
testCompile('nl.jqno.equalsverifier:equalsverifier:1.7.5')
}
Run Code Online (Sandbox Code Playgroud)
我试着加入什么记录这样
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE')
classpath( 'io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE')
}
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'
jar {
baseName …Run Code Online (Sandbox Code Playgroud) 我有ThreadPoolTaskExecutor.我应该发送太多电子邮件(不同的电子邮件).如果我在发送电子邮件时遇到错误,我应该将其写入数据库.
<bean id="taskExecutor"
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="5" />
<property name="maxPoolSize" value="10" />
<property name="WaitForTasksToCompleteOnShutdown" value="true" />
</bean>
Run Code Online (Sandbox Code Playgroud)
我正在执行任务.taskExecutor.execute(可运行).一切都很好!
@Override
public void run() {
try {
mailService.sendMail();
} catch (Throwable t) {
daoService.writeFaillStatus();
}
}
Run Code Online (Sandbox Code Playgroud)
一切似乎都好!异步请求运行良好!
我也有
white(true) {
if(executor.getActiveCount()==0){
executor.shutdown(); break;
}
Thread.sleep(3000)
}
Run Code Online (Sandbox Code Playgroud)
由于WaitForTasksToCompleteOnShutdown = true,任务永远不会自动关闭.换句话说,主线程永远不会被销毁(主线程是我调用线程执行器任务的线程 - 当我在eclipse中运行代码时,终端始终处于活动状态).即使执行程序线程完成他们的工作后我的控制台看起来像这样:
我认为这是因为,主要线程正在等待 - 有人告诉"一切都已经完成,放松,去关闭"
所以考虑这个解决方案(真实).你能告诉我这是不是好主意?可能它不好.
我知道这个执行器也有submit()方法.我想我不需要这里.请纠正我如果我在这篇文章中不正确.
spring-io ×11
spring ×6
java ×5
spring-boot ×3
bean-io ×1
build.gradle ×1
gradle ×1
grails ×1
maven-3 ×1
reactor ×1