如何加载${catalina.home}/conf/application.propertiesSpring/Tomcat webapp?
在StackOverflow和Google上四处看看,我看到很多讨论声称它是可能的.但是,这对我不起作用.根据我的研究建议,我的Spring applicationContext.xml文件包含以下行:
<context:property-placeholder location="${catalina.home}/conf/application.properties"/>
Run Code Online (Sandbox Code Playgroud)
但是我在日志中得到了这个:
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/Users/username/Servers/apache-tomcat-6.0.36/conf/application.properties]
Run Code Online (Sandbox Code Playgroud)
从日志条目中我可以看到${catalina.home}正在正确扩展.当我在applicationContext.xml文件中手动展开它时,它返回相同的错误.以下内容按预期返回application.properties文件的内容:
cat /Users/username/Servers/apache-tomcat-6.0.36/conf/application.properties
Run Code Online (Sandbox Code Playgroud)
所以道路显然是正确的.这是webapp安全性还是Tomcat服务器配置问题?
我们一直在使用Apache ActiveMQ和Camel产品,但是想要看一个好的基础ESB.我一直在阅读有关Fuse的Redhat网站,但无法找到有关编码器的Fuse和Apache之间重大差异的一个很好的总结.
从设计人员/开发人员的角度来看,Fuse与我们一直使用的Apache Camel和ActiveMQ之间的重大差异是什么?我得到了可爱的概述,FuseIDE和ESB管理工具.但我真的只想知道代码级别的差异,即它是否引入了更有用的Camel端点?还有其他真正有用的东西库可以让我作为设计师/编码员的生活变得更轻松吗?是否有任何陷阱需要注意?
我只需要一些指示来帮助我进行搜索,而不是一本书.或者更好的是一个快速链接到一个文件,覆盖所有这些(永远希望:o)!)我有一个短时间形成一个观点继续前进或机会将通过我.
谢谢.
SK
我正在一个包含3.5亿行的表上运行alter table语句.我怎么知道这个陈述实际上是在做什么而且没有挂?同样,我不想在它完成之前的某个时刻打扰一个声明.特别是在它运行了几个小时之后.
我需要能够在Bash或PERL中编写脚本,因为我的主机是Redhat Linux机器.本案中的陈述是:
ALTER TABLE table_name AUTO_INCREMENT = 1;
Run Code Online (Sandbox Code Playgroud) 我正在将我的 Scala 版本从 2.11 升级到 2.12,对象映射器似乎坏了。我的代码的其他部分需要仅在 2.12 下可用的功能。
这使用 scala 2.12 和 spark 2.1提到重建 Jackson 作为可能的解决方案。这真的有必要还是有更简单的解决方案?
Scala 2.11.0 的 SBT 配置
// Identity
name := "ScalaJsonSpike00"
organization := "com.acme"
// Versions
version := "1.0"
scalaVersion := "2.11.0"
// Scala test
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
// JSON
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.8"
// https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-scala_2.11
libraryDependencies += "com.fasterxml.jackson.module" % "jackson-module-scala_2.11" % "2.8.8"
Run Code Online (Sandbox Code Playgroud)
2.11 和 2.12 的代码
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import …Run Code Online (Sandbox Code Playgroud) 我在使用Spring在Web应用程序中创建普通的Camel上下文时遇到了麻烦.我已经创建了一个新的maven项目,并在重新创建问题之前删除了我的maven存储库.除了Maven添加的文件之外,项目中的唯一文件是InitialContext.xml,web.xml和pom.xml.初始上下文文件如下所示:
web.xml中
<?xml version="1.0" encoding="UTF-8"?>
<web-app
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>CamelSpring</display-name>
<context-param>
<param-name>
contextConfigLocation
</param-name>
<param-value>
/WEB-INF/InitialContext.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
</web-app>
Run Code Online (Sandbox Code Playgroud)
InitialContext.xml
<?xml version="1.0" encoding="US-ASCII"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"/>
</beans>
Run Code Online (Sandbox Code Playgroud)
的pom.xml
<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>
<groupId>nz.co.home</groupId>
<artifactId>CamelSpring</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>CamelSpring</name>
<url>http://maven.apache.org</url>
<properties>
<camelVersion>2.10.4</camelVersion>
<springVersion>2.5.6.SEC03</springVersion>
</properties>
<dependencies>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<!-- Camel …Run Code Online (Sandbox Code Playgroud) 我正在使用Camel 加密工具来处理PGP数据,但要求将所用密钥的密码在配置文件中加密或从其他位置的安全服务器获取。如果不生成自己的PGP处理器,是否可以实现?
我想监视zip文件的目录,然后使用Camel和Spring DSL单独处理zip文件中的文件.是否有类似以下内容?
<camel:route>
<camel:from uri="file:/src/Path/"/>
<camel:split streaming="true">
<zipSplit/>
<camel:to uri="bean:fileProcessor?method=processStream"/>
</camel:split>
</camel:route>
Run Code Online (Sandbox Code Playgroud)
好的,我发现以下适用于包含一个文件的zip文件,但问题是如何处理包含多个文件的zip文件?
<bean id="zipFileDataFormat" class="org.apache.camel.dataformat.zipfile.ZipFileDataFormat"/>
<camel:camelContext>
<camel:contextScan/>
<camel:route>
<camel:from uri="file:///C:/testSrc/?delay=6000&noop=true&idempotent=false"/>
<camel:unmarshal ref="zipFileDataFormat"/>
<camel:to uri="file:///C:/testDst"/>
</camel:route>
</camel:camelContext>
Run Code Online (Sandbox Code Playgroud)
请注意,该文件未被发送到bean以进行处理,只是解压缩到另一个目录中.