@PropertySource在Spring 3.1中使用新的注释,如何使用Environment访问多个属性文件?
目前我有:
@Controller
@Configuration
@PropertySource(
name = "props",
value = { "classpath:File1.properties", "classpath:File2.properties" })
public class TestDetailsController {
@Autowired
private Environment env;
/**
* Simply selects the home view to render by returning its name.
*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
String file1Name = env.getProperty("file1.name","file1.name not found");
String file2Name = env.getProperty("file2.name","file2.name not found");
System.out.println("file 1: " + file1Name);
System.out.println("file 2: " + file2Name);
return "home";
}
Run Code Online (Sandbox Code Playgroud)
结果是File1.properties中的文件名正确,但找不到file2.name …
在URLConnection上发送"完整"cookie的正确方法是什么?
我一直在用:
URL url = new URL(page);
URLConnection urlConn = url.openConnection();
urlConn.setRequestProperty("Cookie", myCookie);
urlConn.setUseCaches(true);
urlConn.connect();
Run Code Online (Sandbox Code Playgroud)
所述的myCookie值为testCookie = d1lEZk9rSHd3WnpBd2JkWGRhN1RYdz09OkEwQ21pSFJVZzBpVDhhUENaK3ZPV2c9PQ
有没有办法用它发送Path,Domain和Expires?您需要以某种方式对值进行编码吗?
cfpdf可以直接读取二进制数据库列吗?
我目前在运行查询以获取列的位置.
使用cffile将文件写入目录
然后阅读cfpdf,以便我可以提取文本.
是否可以在没有cffile写入的情况下直接读取二进制文件?
如果是这样,我能得到一个例子.
我有一个要测试的DAO,它使用jdbcTemplate。春天的jdbcTemplate上面有一个datasoruce属性,需要对其进行设置才能使其正常工作。但是,当运行JUNIT测试时,数据源不存在,并且Bean创建失败。如何设置jdbcTemplate的数据源以在JUNIT测试用例中工作?
任何帮助表示赞赏。
谢谢
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'thisDatasource' defined in class path resource [userDataBaseContext.xml]: Invocation of init method failed; nested exception is javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 33 more
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system …Run Code Online (Sandbox Code Playgroud) 我有一个多项目 gradle 构建,我正在尝试使用 sonarqube 进行分析。它成功分析了项目中的所有嵌套模块,但不分析基础项目或父项目。
我在日志中看到此警告:
12:07:23.332 警告 - /!\ 多模块项目不能有源文件夹,因此“C:\workspaces\platform\myProject\src\main\java”不会用于分析。如果你想分析这个文件夹的文件,你应该创建另一个子模块并将它们移动到其中。
有没有办法将父级 src、测试和二进制文件移动为要扫描的文件夹,而无需从父级中创建子模块?
我的 SonarQube 属性如下所示:
sonarqube{
properties {
property "sonar.host.url", "http://ww:80"
property "sonar.jdbc.url", "jdbc:jtds:sqlserver://db:5555;databaseName=sonarqube"
property "sonar.jdbc.driverClassName", "net.sourceforge.jtds.jdbc.Driver"
property "sonar.jdbc.username", "u"
property "sonar.jdbc.password", "p"
property "sonar.scm.disabled", "true"
property "sonar.junit.reportsPath", "${buildDir}/test-results"
property "sonar.jacoco.reportPath", "${buildDir}/jacoco/test.exec"
property "sonar.modules" , "" }
}
Run Code Online (Sandbox Code Playgroud) 假设我的页面中有2个链接,并且当单击任一链接时,我希望在页面上鼠标所在的位置(鼠标x,y)显示隐藏的div.另外,我想传入一个值来设置div的标题(参见divTitle id).
我怎样才能使用jQuery实现这一目标?
隐藏的分区:
<div class="boxFAQ" id="questionMarkId">
<span id="divTitle"></span>
SHOW ME!
</div>
Run Code Online (Sandbox Code Playgroud) java ×2
spring ×2
binary ×1
cfpdf ×1
click ×1
coldfusion ×1
cookies ×1
datasource ×1
hidden ×1
html ×1
jdbctemplate ×1
jquery ×1
junit ×1
mouseevent ×1
pdf ×1
sonarqube ×1
spring-mvc ×1