小编Ash*_*vin的帖子

如何在 LibreOffice Calc 中获取字符的最后位置

我想从 LibreOffice Calc 中多次出现的字符中获取最后一次出现的情况。

例如我有一个字符串abc1ba2ac2adeaa43add。现在,如果我正在搜索a它应该返回 18。

lastindexof libreoffice-calc

5
推荐指数
1
解决办法
7070
查看次数

检测到循环@Import

  • 我在使用 spring-boot version 之前几个月创建了 spring-boot 自动配置库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)

spring spring-boot

5
推荐指数
1
解决办法
5937
查看次数

使用带有布尔值的jstl时的PropertyNotFoundException

我有一个重命名了布尔变量的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)

请建议我解决方案.

提前致谢.

java jsp jstl

3
推荐指数
1
解决办法
2543
查看次数

一级缓存不适用于 JPA 和 Hibernate

我是使用休眠缓存的新手(第一级、第二级和查询缓存)。

我的项目是使用 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)

java spring caching hibernate jpa

3
推荐指数
1
解决办法
4340
查看次数

在 spring-boot 项目中版本更改时不会抛出 OptimisticLockException

模型结构:

@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)

当 …

jpa spring-data-jpa spring-boot

3
推荐指数
1
解决办法
4373
查看次数