小编Gre*_*ber的帖子

当spring-boot运行时,IntelliJ进程以退出代码0结束

从IntelliJ-Idea启动spring-boot应用程序时遇到问题.通过终端运行应用程序时没有这个问题.

:: Spring Boot ::        (v1.2.1.RELEASE)

2015-09-24 12:22:44.274  WARN 22380 --- [           main] n.sf.ehcache.config.CacheConfiguration   : Cache 'publicationsCount' is set to eternal but also has TTI/TTL set.  To avoid this warning, clean up the config removing conflicting values of eternal, TTI and TTL. Effective configuration for Cache 'publicationsCount' will be eternal='true', timeToIdleSeconds='0', timeToLiveSeconds='0'.

Process finished with exit code 0
Run Code Online (Sandbox Code Playgroud)

我认为这种警告并不会导致它.可能是什么原因?

java spring intellij-idea spring-boot

33
推荐指数
5
解决办法
2万
查看次数

WrongClassException:对象[id = null]不是指定的子类

我的模型如下:

@Entity(name = "request")
public class VisitRequest {
  @Id
  @GeneratedValue
  private Long id;

  @OneToMany(mappedBy = "visitRequest", cascade = CascadeType.ALL, orphanRemoval = true)
  @JsonManagedReference
  private List<Visitor> visitors;

  //default constructor, getters and setters
}

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "class")
public class Visitor {
  @Id
  @GeneratedValue
  private Long id;

  @ManyToOne
  @JsonBackReference
  private VisitRequest visitRequest;

  //default constructor, getters and setters

}

@Entity
public class ContactPerson extends Visitor {

  private PhoneNumber phoneNumber;

  //default constructor, getters and setters …
Run Code Online (Sandbox Code Playgroud)

java hibernate jpa

6
推荐指数
1
解决办法
1826
查看次数

Spring:如何从 RestTempalte 获取 rootUri

我正在使用这个配置类来初始化 RestTemplate:

@Configuration
public class RestTemplateConfig {

  @Value("${endpoint-url}")
  private String endpointUrl;

  @Bean
  public RestTemplate restTemplate(RestTemplateBuilder builder) {
    return builder
        .rootUri(endpointUrl)
        .messageConverters(new MappingJackson2HttpMessageConverter())
        .build();
  }
}
Run Code Online (Sandbox Code Playgroud)

在我的服务方法之一中,我使用了代码:

RootUriTemplateHandler handler = (RootUriTemplateHandler) restTemplate.getUriTemplateHandler();
String uri = handler.getRootUri();
restTemplate.postForLocation(uri, request);
Run Code Online (Sandbox Code Playgroud)

获取这个URI。有没有更简单的方法来获得这个 rootUri(没有强制转换)?还是直接向rootUri执行post请求?

java spring resttemplate

6
推荐指数
2
解决办法
3438
查看次数

@CreationTimestamp 不适用于 H2 和 Oracle10gDialect

我有一个课程请求:

@Entity
public class Request {
  @CreationTimestamp
  private Date createdDate;
}
Run Code Online (Sandbox Code Playgroud)

当我使用以下方法测试它时:

Request request = requestRepository.save(new Request());
request.getCreatedDate();
Run Code Online (Sandbox Code Playgroud)

由于某种原因 getCreatedDate 仍然为空。

我使用 H2 和 Oracle10gDialect 进行测试(当我使用 H2 的默认方言时它可以工作)。

你知道我该如何修复它吗?

java hibernate h2 spring-data-jpa

6
推荐指数
0
解决办法
626
查看次数

我在使用tomcat时无法加载字体

使用tomcat时加载字体时出现此类错误:

1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-bold-webfont.woff2

1 OTS解析错误:无法将WOFF 2.0字体转换为SFNT

1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-regular-webfont.woff2

1 OTS解析错误:无法将WOFF 2.0字体转换为SFNT

1无法解码下载的字体:https://my-address.com/css/fonts/fontawesome-webfont.woff2?v = 4.3.0

1 OTS解析错误:无法将WOFF 2.0字体转换为SFNT

1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-regular-webfont.woff

1 OTS解析错误:WOFF标头中的文件大小不正确

1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-bold-webfont.woff

1 OTS解析错误:WOFF标头中的文件大小不正确

https:// fake .com /无法加载资源:net :: ERR_BLOCKED_BY_CLIENT

1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-regular-webfont.ttf

1 OTS解析错误:FFTM:未对齐的表

1无法解码下载的字体:https://my-address.com/css/fonts/fontawesome-webfont.woff?v = 4.3.0

1 OTS解析错误:WOFF标头中的文件大小不正确

1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-bold-webfont.ttf

1 OTS解析错误:GDEF:未对齐的表

1无法解码下载的字体:https://my-address.com/css/fonts/fontawesome-webfont.ttf?v = 4.3.0

1 OTS解析错误:表目录的entrySelector不正确

1无法解码下载的字体:https://my-address.com/css/fonts/robotocondensed-light_0-webfont.woff2

1 OTS解析错误:无法将WOFF 2.0字体转换为SFNT

1无法解码下载的字体:https …

fonts tomcat font-awesome

4
推荐指数
1
解决办法
6184
查看次数