小编Cor*_*chi的帖子

java.util.date使用DateTimeFormatter转换为String

如何使用java将java.util.Date转换为String

 DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss")
Run Code Online (Sandbox Code Playgroud)

我得到的Date对象被传递

DateTime now = new DateTime(date);
Run Code Online (Sandbox Code Playgroud)

java datetime jodatime java-8

13
推荐指数
3
解决办法
3万
查看次数

访问Jenkins Build Pipeline Console中的HTTP ERROR 404

配置Jenkins后,在Build Pipeline中单击控制台图像时出现错误.

问题是因为/ view/jobName在URL中重复了两次.

我该如何解决这个问题

HTTP ERROR 404

Problem accessing           

/view/<jobName>/view/<jobName>/job/<jobName>/2571/console
. Reason:
Not Found
Powered by Jetty://
Run Code Online (Sandbox Code Playgroud)

jenkins jenkins-plugins

9
推荐指数
0
解决办法
2405
查看次数

在 JPA 中扩展实体类在“字段列表”错误中引发未知列“DTYPE”

@Entity
@Table(name = "PERSON")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)  
public class Person {    
    @Id
    @GeneratedValue
    @Column(name = "PERSON_ID")
    private Long personId;

    @Column(name = "FIRSTNAME")
    private String firstname;

    @Column(name = "LASTNAME")
    private String lastname;

    // Constructors and Getter/Setter methods, 
}
Run Code Online (Sandbox Code Playgroud)

Employee 类扩展了 Person

@Entity    
public class Employee extends Person {

    @Transient
    private Date joiningDate;   


    // Copy Constructors and Getter/Setter methods, 
}
Run Code Online (Sandbox Code Playgroud)

Employee 类只有一个瞬态对象所以我不确定是否使用 @DiscriminatorColumn 和 @DiscriminatorValue,当我尝试不使用会引发错误的鉴别器时

session.save(employee);
Run Code Online (Sandbox Code Playgroud)

我正在尝试保存在“字段列表”错误中引发未知列“DTYPE”的员工对象

java spring hibernate jpa

8
推荐指数
2
解决办法
8054
查看次数

Ehcache从2.6迁移到3.00

我正在尝试将我的项目的Ehcache从2.6升级到3.0版本.

net.sf.ehcache.Element和CacheExceptionHandler的任何替换.

关于Ehcache 3的文档较少,任何人都可以提供一些将Ehacahe升级到版本3的技巧.

caching ehcache hibernate-cache

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

处理 Spring Boot WebServiceTemplate 中的 SOAP 错误

我是 SOAP 新手,尝试使用 Spring Boot 运行示例 SOAP 客户端

使用 WebServiceTemplate 时如何处理 SOAP 故障、异常或错误

 public class CountryClient extends WebServiceGatewaySupport {

  private static final Logger log = LoggerFactory.getLogger(CountryClient.class);

  public GetCountryResponse getCountry(String country) {

    GetCountryRequest request = new GetCountryRequest();
    request.setName(country);

    log.info("Requesting location for " + country);

    GetCountryResponse response = (GetCountryResponse) getWebServiceTemplate()
        .marshalSendAndReceive("http://localhost:8080/ws/countries", request,
            new SoapActionCallback(
                "http://spring.io/guides/gs-producing-web-service/GetCountryRequest"));

    return response;
  }

}
Run Code Online (Sandbox Code Playgroud)

soap spring-boot

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

Mysql随时间23:59:59获取当前日期

如果我执行

select current_date;
Run Code Online (Sandbox Code Playgroud)

这将给出当前日期.

如果我必须在23:59:59获得当前日期,那么它将在当天结束时怎么办?

在我使用的SQL Server中

Select CAST(CONVERT(VARCHAR(10), GETDATE(), 110) + ' 23:59:59' AS   
DATETIME;
Run Code Online (Sandbox Code Playgroud)

mysql sql sql-server

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

AuthenticationManager和AuthenticationProvider的区别在Spring Security中验证方法

是否有任何区别?

Authentication auth= authenticationManager.authenticate(authentication);
Run Code Online (Sandbox Code Playgroud)

 Authentication auth= authenticationProvider.authenticate(authentication);
Run Code Online (Sandbox Code Playgroud)

spring-security spring-boot

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

Spring AOP根据参数名获取方法参数值

是否可以在Spring AOP中根据参数名称获取方法参数值。

MethodSignature signature = (MethodSignature) proceedingJoinPoint.getSignature();

Method method = signature.getMethod();

method.getParameters().getName() 
// possible to get the paramater names 
Run Code Online (Sandbox Code Playgroud)

这种方法将获得参数名称,而不是值。

proceedingJoinPoint.getArgs()
Run Code Online (Sandbox Code Playgroud)

将返回值而不是名称

那么是否可以根据参数名称获取值?

spring spring-aop

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

Spring Boot 应用程序在 main 方法中从属性文件中读取值

我正在尝试获取财产的价值

hello.world=Hello World
Run Code Online (Sandbox Code Playgroud)

在 MainApp 类中

@SpringBootApplication
public class MainApp {
   public static void main(String[] args) {
      SpringApplication.run(MainApp.class, args);
}
Run Code Online (Sandbox Code Playgroud)

这不是它的主要方法。

@Value("${hello.world}")
public static String helloWorld;
Run Code Online (Sandbox Code Playgroud)

也许它可以加载

  Properties prop = new Properties();

    // load a properties file
    prop.load(new FileInputStream(filePath));
Run Code Online (Sandbox Code Playgroud)

在 SpringApplication.run 之前的 SpringBoot 的 main 方法中,有没有其他更好的方法来使用 Spring 获取属性

spring spring-boot

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

在 Spring Boot 中运行单元测试时更改类的事务传播

我有一个 A 类,注释有事务传播需要新的

@Component
@Transactional(propagation = REQUIRES_NEW)
public class A implements B{ 


}
Run Code Online (Sandbox Code Playgroud)

运行单元测试时是否可以将事务传播更改为类似的内容

@Component
@Transactional(propagation=Propagation.REQUIRED)
public class A implements B{ 


} 
Run Code Online (Sandbox Code Playgroud)

我想到有两个实现 B 的类,一个用于需要传播的单元测试。

也许是一种丑陋的使用方式,寻找更好的选择。

spring spring-transactions spring-boot

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

ehcache maxElementsInMemory 和 maxEntriesLocalHeap 的性能差异

我在 Ehcache 中使用 maxElementsInMemory,最近我知道从 2.5 开始它已被弃用,并且使用了 maxEntriesLocalHeap。

maxEntriesLocalHeap 中的任何性能增强或仅更改名称。

ehcache ehcache-bigmemory

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