我已经来回试了很长时间,但不知何故它不起作用.
我也尝试过分号和不分号.我也尝试在断点之前运行这一行,以确保条件真正起作用,
logger.error("I am Here! " + "#PDU Elements: " + pdu.getVariables().size());
Run Code Online (Sandbox Code Playgroud)
它按预期返回13.
有谁知道如何让这个工作?
编辑
根据要求,我将在断点处添加运行的代码行,
logger.error("I am Here! " + "#PDU Elements: " + pdu.getVariables().size());
Trap trap = Trap.createTrapFrom(variableMap, instanceIdentificationNumber); // Breakpoint in margin on this line.
Run Code Online (Sandbox Code Playgroud)
编辑2
问题似乎与IDEA随机错过一些断点有关.我也尝试了一些无条件断点(应该总是停止),这些断点只在特定时间停止.
我正在使用 Spring Boot 2.0.0.RELEASE、Thymeleaf、Spring Security、JDK 10、Apache Tomcat 9.0.6 。我有控制器
package com.donhuvy.controller;
import com.donhuvy.entity.Ccy;
import com.donhuvy.repository.CcyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import java.util.Optional;
@Controller
@RequestMapping("/ccy")
public class CcyController {
private static final int INITIAL_PAGE = 0;
private static final int INITIAL_PAGE_SIZE = 10;
@Autowired
CcyRepository ccyRepository;
@RequestMapping(value = "/all", method = RequestMethod.GET)
public ModelAndView getAllPaginatingCcy(
@RequestParam("pageSize") Optional<Integer> pageSize,
@RequestParam("page") Optional<Integer> page) {
int evalPageSize = pageSize.orElse(INITIAL_PAGE_SIZE); …Run Code Online (Sandbox Code Playgroud) 我在生产文件中有以下配置:
@Configuration
internal class Config {
@Bean
fun clock() = Clock.systemUTC()
}
Run Code Online (Sandbox Code Playgroud)
在测试中:
@Configuration
class ClockTestConfiguration {
@Bean
fun clock() = SetableClock()
}
Run Code Online (Sandbox Code Playgroud)
我的测试注释:
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = [
MyApplication::class,
ClockTestConfiguration::class
]
)
class MyTest {
...
Run Code Online (Sandbox Code Playgroud)
当我使用Spring Boot时,2.0.5.RELEASE它就像一个魅力.2.1.0.RELEASE在bean注册期间升级到它失败.
Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'clock' defined in com.foo.clock.ClockTestConfiguration:
Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=clockTestConfiguration; factoryMethodName=clock; initMethodName=null; destroyMethodName=(inferred);
defined in com.foo.clock.ClockTestConfiguration] for …Run Code Online (Sandbox Code Playgroud)