我已经定义了一个javax.servlet.Filter带有Spring注释的Java类.
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Bean;
@Configuration
public class SocialConfig {
// ...
@Bean
public UsersConnectionRepository usersConnectionRepository() {
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
我想把豆子放进UsersConnectionRepository去Filter,所以我尝试了以下方法:
public void init(FilterConfig filterConfig) throws ServletException {
UsersConnectionRepository bean = (UsersConnectionRepository) filterConfig.getServletContext().getAttribute("#{connectionFactoryLocator}");
}
Run Code Online (Sandbox Code Playgroud)
但它总是回归null.我怎样才能获得一个Spring bean Filter?
阅读关于如何启用Dropwizard指标的HikariCP wiki上的说明,它说只需在HikariConfig或HikariDatasource中配置MetricsRegistry实例.问题是,在Spring Boot中,所有配置都由自动配置处理,因此我根本不会手动配置HikariCP池.有关如何执行此操作的任何说明?我是否必须通过定义自己的bean并在@Configuration文件中设置所有设置来完全覆盖自动配置?
java connection-pooling spring-boot hikaricp codahale-metrics
有人有SLF4J/logback与JBoss 7一起工作吗?
以前,通过在[server]/conf中放置我的"logback.groovy",以及在logback核心,经典(0.9.28)和Groovy(1.8.0)JAR中,我能够让我的应用程序在JBoss 5.1中运行[服务器]/lib中.
对于JBoss 7.0.1,我已经设置了Groovy和logback模块(已经创建了.index文件),我的EAR的MANIFEST.MF声明了对两个模块的依赖关系,我的"logback.groovy"部署在我的我的EAR中的WAR模块的WEB-INF/classes.EAR肯定部署好 - 灯是绿色的......
尽管如此,实际应用的唯一日志记录规则是在"standalone.xml"中设置的标准console/server.log.是的,我可以看到我的日志语句(因此SLF4J正在运行),但我的注销规则,追加者等被忽略了.在任何日志记录中都没有引用logback或Groovy,所以我假设我没有做足够的事情来触发logback的加载并找到我的脚本.
还有其他我可以尝试的东西,但是知道其他人是否尝试过这个会很好.如果他们没有,或许这是一个迹象,我应该抛弃我的JBoss Logging?
ehcache doc(http://ehcache.org/documentation/configuration/cache-size)将maxEntriesLocalHeap描述为
高速缓存可以在本地堆内存中使用的最大高速缓存条目数或字节数,或者,当设置为CacheManager级别(仅限maxBytesLocalHeap)时,可用于该CacheManager下的所有高速缓存的本地池.每个缓存或CacheManager级别都需要此设置.
这是否意味着对于此配置:
<cache
name="myCache"
maxEntriesLocalHeap="5000"
eternal="false"
overflowToDisk="false"
timeToLiveSeconds="10000"
memoryStoreEvictionPolicy="FIFO" />
Run Code Online (Sandbox Code Playgroud)
可以添加到缓存的最大对象数为5000.这些对象可以包含多个子对象,但只添加顶级父对象作为条目.因此,如果每个对象都引用了另外两个对象,那么maxEntriesLocalHeap对象的数量可能会增加到15000(此时最旧的对象会在添加新对象时被换出).它是否正确 ?
我开始学习Spring注解。我目前正在配置类中使用@PropertySource注释来解析属性值,一切正常,但后来我读到了有关PropertySourcesPlaceholderConfigurer.
我何时或为何应该使用它?
有关WebdriverIO与Selenium的反馈意见吗?我处于两难境地,想要消除这种困惑.
我花了几天时间学习WebdriverIO并做了一些实践,但得出的结论还不够成熟.调试确实是一个挑战.
这是场景.
当我使用GetSize(),GetLocation()函数对图像ID'FlashID1x'时它总是给出250,300,但元素的实际高度和宽度是1 X 1,这基本上是错误的.
这是我的目标dom:
<img id="FlashID1x" border="0" width="300" height="250" style="width:300px;height:250px;" alt="" src="http://s2.adform.net/Banners/invisible.gif?bv=2"/>
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
System.out.println("total : "+iframe.size());
//driver.switchTo().frame(frame);
org.openqa.selenium.Point point=driver.findElement(By.xpath(".//*[@id='FlashID1x']")).getLocation();
System.out.println("X Position : "+point.x);
System.out.println("Y Position : "+point.y);
System.out.println("X getX : "+point.getX());
System.out.println("Y gety : "+point.getY());
Rectangle pointer=driver.findElement(By.xpath(".//*[@id='FlashID1x']")).getRect();
System.out.println("height : "+pointer.hashCode();
System.out.println(" width : "+pointer.getWidth());
System.out.println("getHeight : "+pointer.getHeight());
System.out.println(" getWidth : "+pointer.getWidth());
Run Code Online (Sandbox Code Playgroud) 我需要从表中获取1000个随机行,并找到Oracle的解决方案.但是,如果我在从包含大量行的表中检索数据时使用此查询,则最多需要3分钟才能完成:
SELECT column FROM
( SELECT column FROM table
ORDER BY dbms_random.value )
WHERE rownum <= 1000
Run Code Online (Sandbox Code Playgroud)
它发生是因为所有行都被选中,然后当我只需要1000时,所有行都按随机值排序.这样的问题是否有解决办法?也许使用dbms_random.value以及一些将选择随机行的游标.
我有一个Centos 6.7发行版,我从源代码安装了python 3.5.
我想要运行pip3,但找不到命令.
在研究之后,我尝试使用ezsetup安装设置工具.
这失败了所以我下载了setuptools-20.9.x解压缩这个并运行python3.5 easy_install并得到错误
#ImportError: No module named 'zipimport'
Run Code Online (Sandbox Code Playgroud) 创建 blob 存储触发函数 (v2) 时出现以下错误。
函数运行时无法启动。Microsoft.WindowsAzure.Storage:未找到请求的值“DELETE、GET、HEAD、MERGE、POST、OPTIONS、PUT、PATCH”。System.Private.CoreLib:未找到请求的值“DELETE、GET、HEAD、MERGE、POST、OPTIONS、PUT、PATCH”。
如果我在 VSTS 中创建函数或通过 Azure 门户创建函数,就会发生这种情况。
KUDO 日志显示以下错误:
2019-06-24T13:00:38.588 [Error] A host error has occurred
Microsoft.WindowsAzure.Storage.StorageException : Requested value 'DELETE,GET,HEAD,MERGE,POST,OPTIONS,PUT,PATCH' was not found. ---> System.ArgumentException : Requested value 'DELETE,GET,HEAD,MERGE,POST,OPTIONS,PUT,PATCH' was not found.
at System.Enum.TryParseEnum(Type enumType,String value,Boolean ignoreCase,EnumResult& parseResult)
at System.Enum.Parse(Type enumType,String value,Boolean ignoreCase)
at Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties.<>c.<ReadCorsPropertiesFromXml>b__67_0(XElement rule)
at System.Linq.Enumerable.SelectEnumerableIterator.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable source)
at Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties.ReadCorsPropertiesFromXml(XElement element)
at Microsoft.WindowsAzure.Storage.Shared.Protocol.ServiceProperties.FromServiceXml(XDocument servicePropertiesDocument)
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ReadServiceProperties(Stream inputStream)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient.<>c.<GetServicePropertiesImpl>b__60_2(RESTCommand cmd,HttpResponseMessage resp,OperationContext ctx)
at async Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteAsyncInternal[T](RESTCommand cmd,IRetryPolicy policy,OperationContext operationContext,CancellationToken token)
End …Run Code Online (Sandbox Code Playgroud) java ×6
spring ×3
spring-boot ×2
azure ×1
caching ×1
centos6 ×1
cursor ×1
ehcache ×1
function ×1
hikaricp ×1
jboss ×1
jboss7.x ×1
linux ×1
logback ×1
node.js ×1
oracle ×1
performance ×1
pip ×1
properties ×1
python-3.x ×1
selenium ×1
servlets ×1
slf4j ×1
spring-mvc ×1
sql ×1
webdriver-io ×1