我想从 LibreOffice Calc 中多次出现的字符中获取最后一次出现的情况。
例如我有一个字符串abc1ba2ac2adeaa43add。现在,如果我正在搜索a它应该返回 18。
1.3.0.RC1。其结构为:
它包含扫描库中组件的 @Configuration 类。
@Configuration
@ComponentScan
public class CoreLibAutoConfiguration {
}
Run Code Online (Sandbox Code Playgroud)
它包含另一个@Configuration类。它的定义是
@Configuration
@Import(CoreLibAutoConfiguration.class)
@ComponentScan
public class MyLibAutoConfiguration {
}
Run Code Online (Sandbox Code Playgroud)
它还包含spring.factories在其类路径中。其中包含在应用程序启动时自动配置该库的条目。
org.springframework.boot.autoconfigure.EnableAutoConfiguration=MyLibAutoConfiguration
现在我已将此库集成到我的 spring-boot Web 应用程序中,该应用程序再次使用相同的 spring-boot 版本1.3.0.RC1。
一切都按预期进行。
但是,现在正在开发另一个使用 spring-boot version 的 spring-boot Web 应用程序1.3.5.RELEASE。
我尝试将几个月前创建的相同库集成到我的新 Web 应用程序中。但我因与循环引用相关的错误而失败。堆栈跟踪是
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: A circular @Import has been detected: Illegal attempt by @Configuration class 'MyLibAutoConfiguration' to import class 'MyLibAutoConfiguration' as 'MyLibAutoConfiguration' is already present in …Run Code Online (Sandbox Code Playgroud) 我有一个重命名了布尔变量的FileBean.它有以下代码.
public class FileBean {
private boolean renamed;
public boolean isRenamed() {
return renamed;
}
public void setRenamed(boolean isRenamed) {
this.renamed = isRenamed;
}
}
Run Code Online (Sandbox Code Playgroud)
我已经使用请求对象将其对象传递给jsp(考虑fileDetail是请求属性名称).我的jsp包含以下代码.
<tr>
<td>${fileDetail.isRenamed}</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
使用这个我在jsp上得到低于运行时异常.
org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: Property 'isRenamed' not found on type <mypackage>.FileBean
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Run Code Online (Sandbox Code Playgroud)
请建议我解决方案.
提前致谢.
我是使用休眠缓存的新手(第一级、第二级和查询缓存)。
我的项目是使用 Spring MVC 和 JPA 配置的。
我正在使用下面的 JUnit 测试用例测试一级缓存。
public class FirstLevelCacheTest
{
private static final Logger logger = LoggerFactory.getLogger(FirstLevelCacheTest.class);
@PersistenceContext
private EntityManager entityManager;
@Test
public void testFirstLevelCacheTest()
{
Long clientId = 1L;
// fetch the client entity from database first time
Client client1 = entityManager.find(Client.class, clientId);
logger.debug("Client Name : {}", client1.getName());
// fetch the client entity again
client1 = entityManager.find(Client.class, clientId);
logger.debug("Client Name : {}", client1.getName());
}
}
Run Code Online (Sandbox Code Playgroud)
我的实体类定义为:
@Entity
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@Table(name = "client")
public class …Run Code Online (Sandbox Code Playgroud) 模型结构:
@MappedSuperclass
public class BaseModel<K extends Comparable> implements Serializable, Comparable<Object> {
private static final long serialVersionUID = 1L;
@Id
private K id;
@Version
private Integer version;
// getter/setter
}
@Entity
public class MyEntity extends BaseModel<String> {
// some fields and it's getter/setter
}
Run Code Online (Sandbox Code Playgroud)
在我的数据库中记录my_entity:
编号:1 版本:1 ...
下面是我的更新方法:
void update(String id, Integer currentVersion, ....) {
MyEntity myEntity = myRepository.findOne(id);
myEntity.setVersion(currentVersion);
// other assignments
myRepository.save(myEntity);
}
Run Code Online (Sandbox Code Playgroud)
下面是调用此方法时触发的查询。
update my_entity set version=?, x=?, y=?, ...
where id=? and version=?
Run Code Online (Sandbox Code Playgroud)
当 …