我的错误是:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot find cache named 'getActionsBycasId' for CacheableOperation[public java.util.List com.codinko.database.DataBaseConnection.getActionsByCasId(int)] caches=[getActionsBycasId] | key='' | keyGenerator='' | cacheManager='' | cacheResolver='' | condition='' | unless=''
at org.springframework.cache.interceptor.AbstractCacheResolver.resolveCaches(AbstractCacheResolver.java:81)
at org.springframework.cache.interceptor.CacheAspectSupport.getCaches(CacheAspectSupport.java:214)
at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.<init>(CacheAspectSupport.java:553)
at org.springframework.cache.interceptor.CacheAspectSupport.getOperationContext(CacheAspectSupport.java:227)
at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContexts.<init>(CacheAspectSupport.java:498)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:299)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at com.codinko.database.DataBaseConnection$$EnhancerBySpringCGLIB$$21a0d8a.getActionsByCasId(<generated>)
at com.codinko.caching.EmployeeDAO.getActionBycasId(EmployeeDAO.java:47)
at com.codinko.caching.EmployeeDAO$$FastClassBySpringCGLIB$$191aa49b.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:649)
at com.codinko.caching.EmployeeDAO$$EnhancerBySpringCGLIB$$3399d753.getActionBycasId(<generated>)
at com.codinko.caching.Main.main(Main.java:22)
Run Code Online (Sandbox Code Playgroud)
我的功能是:
@Cacheable("getActionsBycasId")
public List<SMSAction> getActionsByCasId(int casId){
System.out.println("Inside getActionsByCasId");
//My logic
return list;
}
Run Code Online (Sandbox Code Playgroud)
当我在ehcache.xml下面添加时,上面的错误没有来,但不知道为什么会出现这个错误.
<cache name="getActionsBycasId" maxElementsInMemory="50" eternal="false"
overflowToDisk="false" memoryStoreEvictionPolicy="LFU" …Run Code Online (Sandbox Code Playgroud) 我已经阅读了很多关于isEmpty()和size()0 之间的区别的文章,对于检查是否collection为空或者没有,并且发现isEmpty()有性能size()但我无法理解为什么性能isEmpty()良好即使内部isEmpty()只有size == 0?
我的问题是:
任何人都可以轻松解释哪种情况isEmpty()更快,以及何时使用isEmpty()和size()功能检查是否collection是empty?
任何人都可以使用代码或其他方式(图表,图表等)解释这一点,以便任何初学者都能轻松理解吗?
我知道当我触发查询时BeanPropertyRowmapper使用setter方法,select但它使用getter方法吗?
我面临以下问题:
在中database,defaultPriority 在string但我想int在我的SMSActionpojo 类中设置值。
class SMSAction implements Serializable {
private int defaultPriority;
public int getDefaultPriority() {
System.out.println("Inside getDefaultPriority()");
return defaultPriority;
}
public void setDefaultPriority(String defaultPriority) {
System.out.println("Inside setDefaultPriority(String defaultPriority)"+defaultPriority);
if(defaultPriority.equalsIgnoreCase("L")){
System.out.println("Condition");
this.defaultPriority = 1;
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [select SMSACTIONID,SMSACTIONCODE,ACTIONDESC,CASID,DEFAULTPRIORITY from tblsmsaction]; SQL state [99999]; error code [17059]; Fail to convert …Run Code Online (Sandbox Code Playgroud) 数据库: Oracle
我有一个表,其中有10列,我想要插入行时序列下一个值,并使用插入的序列号.
现在我已经搜索并发现Spring的KeyHolder很有用,但仅限于少于8个字段,所以我不能使用它.
如何启动"select MySequence.nextval from dual"查询并获取序列jdbctemplate(NamedParameterJDBCTemplate)?
是获得插入序列值的其他方法吗?
我是新来的春天和阅读,我们不能使用@Cacheable带有static method但不能发现为什么我们不能用那么任何一个能解释让初学者也很容易理解?我们可以使用静态方法进行检索database table吗?我已经制作static method了service layerDAO 的所有方法,所以这是thread-safe吗?
我正在尝试在核心java项目(swing应用程序)中部署restful web-service.我正在使用jersy.我已经搜索到谷歌的许多网站,但我无法找到为什么这附加.
public class Main {
public static void main(String[] args) throws Exception{
ResourceConfig resourceConfig = new ResourceConfig(MyResource.class);
URI baseUri = UriBuilder.fromUri("http://localhost/").port(10049).build();
HttpServer server = JdkHttpServerFactory.createHttpServer(baseUri,resourceConfig);
server.start();
System.out.println("Press Enter to stop the server. ");
System.in.read();
server.stop(0);
}
}
@Path("/hello")
public class MyResource {
// This method is called if TEXT_PLAIN is request
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello() {
return "Hello Jersey";
}
// This method is called if XML is request
@GET
@Produces(MediaType.TEXT_XML)
public String sayXMLHello() {
return "sdasd";
} …Run Code Online (Sandbox Code Playgroud) 我已经浏览了以下网站,但无法得到我的解决方案。 四舍五入到小数点后 2 位
我有以下小数并想四舍五入到最接近的整数:
34.56 => 35
34.67 => 35
34.12 => 34
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这个:
"$subtract": [
"$x",
{ "$mod": ["$x", 1] }
]
Run Code Online (Sandbox Code Playgroud)
与Oracle Round 函数相同
我可以在 MongoDB 中做什么?
java ×5
spring ×4
database ×2
ehcache ×2
caching ×1
collections ×1
httpserver ×1
is-empty ×1
jakarta-ee ×1
jdbctemplate ×1
jersey ×1
mongodb ×1
oracle ×1
performance ×1
rest ×1
rounding ×1
size ×1
spring-mvc ×1