小编lsc*_*lsc的帖子

在Spring启动时启用Redis缓存

我的弹簧启动项目配置如下.

@SpringBootApplication
@EnableTransactionManagement
@EnableCaching
@EnableScheduling
@EnableAsync
public class Application {

    String redisHost = "localhost";
    int redisPort = 6379;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
    @Bean
    JedisConnectionFactory jedisConnectionFactory() {
        JedisConnectionFactory factory = new JedisConnectionFactory();
        factory.setHostName(redisHost);
        factory.setPort(redisPort);
        factory.setUsePool(true);
        return factory;
    }
    @Bean
    RedisTemplate<Object, Object> redisTemplate() {
        RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<Object, Object>();
        redisTemplate.setConnectionFactory(jedisConnectionFactory());
        return redisTemplate;
    }
    @Bean
    public CacheManager cacheManager() {
        RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate());
        return cacheManager;
    }
}
Run Code Online (Sandbox Code Playgroud)

我也跟随maven对pom的依赖.

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

我在定义端口上的本地计算机上运行了一个单独的redis服务器.另外在我的服务类中,我有@Cacheable,@ CachePut等注释来支持缓存.

我可以毫无错误地启动Spring启动应用程序,并且CRUD操作也可以.但似乎它没有使用定义的redis缓存.我使用'redi …

redis spring-data-redis spring-boot spring-cache

7
推荐指数
1
解决办法
2万
查看次数

Jboss错误:ResourceConfig实例不包含任何根资源类

我知道这是一个普遍的问题,已经得到了回答,但这些答案对这种情况没有帮助.

在Jboss7.1最终版本中得到此错误而不是在Tomcat中(与tomcat版本7一起正常工作)(使用相同的WAR文件检查)

com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1300)
com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:163)
Run Code Online (Sandbox Code Playgroud)

web.xml中

<display-name>myj2ee.app</display-name>
    <servlet>
        <servlet-name>jersey-serlvet</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>myj2ee.app</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>jersey-serlvet</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
Run Code Online (Sandbox Code Playgroud)

的pom.xml

<dependencies>
    <dependency>
        <groupId>org.jboss.spec</groupId>
        <artifactId>jboss-javaee-6.0</artifactId>
        <version>1.0.0.Final</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-servlet</artifactId>
        <version>1.14</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.14</version>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

REST资源类

@Path("/hello")
public class HelloWorldService {

    @GET
    @Path("/{param}")
    public Response getMsg(@PathParam("param") String msg) { 
        String output = "Jersey say : " + msg; 
        return Response.status(200).entity(output).build(); 
    }

} …
Run Code Online (Sandbox Code Playgroud)

rest jersey jboss7.x

5
推荐指数
0
解决办法
3050
查看次数

如何获取附件的可下载链接?

我为一个帐户上传了 jpeg 图像。jpeg 图像文件 id 是 069i0000001dkl8,它无法通过https://c.na15.content.force.com/servlet/servlet.FileDownload?file=069i0000001dkl8访问

但它可以通过 https://c.na15.content.force.com/sfc/servlet.shepherd/version/download/068i0000001hwPn?asPdf=false&operationContext=CHATTER 访问

有没有办法可以在 Salesforce 中获取附件的可下载 URL(使用 api 调用)?或者有没有办法通过处理 API 对象 (SObject) 中的某些字段来构建可下载的 URL?

谢谢。

salesforce salesforce-service-cloud

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

使用 Flutter 绘制平滑的线条

我正在尝试使用自定义画家用颤动来绘制线条。即https://medium.com/flutter-community/drawing-in-flutter-using-custompainter-307a9f1c21f8

如何让用户绘制的线条变得流畅?

dart flutter

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