我的Spring启动应用程序中有以下项目结构,我想使用Thymeleaf
projectName
-Gradle-Module1(Spring boot module)
-build
-src
-main
-resources
-templates
index.html
build.gradle
-Gradle-Module2
...
build.gradle
...
Run Code Online (Sandbox Code Playgroud)
但是spring-boot找不到我的模板目录并显示警告
Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
Run Code Online (Sandbox Code Playgroud)
PS:我正在使用 @EnableAutoConfiguration
在我的控制器代码中,我正在做类似的事情
@Controller
@EnableAutoConfiguration
public class BaseController {
@RequestMapping(value = "/")
public String index() {
return "index.html";
}
}
Run Code Online (Sandbox Code Playgroud)
和index.html文件只打印你好世界.
所以通常它应该看起来src/resources/templates/(我想的是相同的Gradle模块),但不知怎的,它无法找到它.
当我尝试访问时,localhost:8080
我得到以下错误Error resolving template "index.html", template might not exist or might not be accessible by any of the configured Template Resolvers …
我目前在我的ActiveMQ服务器中有一个名为的Queue hello.world.每当消息无法处理时,ActiveMQ都会创建一个名为的默认目录ActiveMQ.DLQ.是否可以将该名称更改为类似的名称hello.world.DLQ?原因是我将来可能有几个队列,我希望它是类似的<queue_name>.DLQ
我想计算我的mule流执行所需的执行时间,所以我使用了拦截器,这里是我的拦截器代码
class CustomLoggerInterceptor extends AbstractEnvelopeInterceptor {
@Override
public MuleEvent last(MuleEvent event, ProcessingTime time, long startTime,
boolean exceptionWasThrown) throws MuleException {
long totalTime=time.getStatistics().getTotalProcessingTime();
LOG.info("Start time for flow: "+event.getFlowConstruct().getName()+" is: "+startTime+" total execution time is: "+totalTime);
return event;
}
//other inherited methods
}
Run Code Online (Sandbox Code Playgroud)
现在的问题是,每当我执行我的骡子流时,我得到的所有值time.getStatistics().getTotalProcessingTime()总是为'0'.
我使用正确的方法还是犯了一些错误?
我基本上需要一种从ProcessingTime对象中查找执行时间的方法.
任何指针赞赏
谢谢!
如何在下面的模拟对象中设置值.我知道如何获取值但是如何使用mock设置值?
public class AUTest
{
Set<String> permissionIds = new HashSet<String>();
@Mock
UserService userservice;
@Mock
PermissionService permissionservice;
Set<String> emailid = new HashSet<String>();
@Test
public void getSuperUserPermissions()
{
List<Permissions> allPermissions = permissionservice.getAllPermissions();
PermissionService permission = Mockito.mock(PermissionService.class);
Mockito.when(permission.getPermissionById(5L)).thenReturn(pemission);
Assert.assertNotNull(allPermissions);
}
}
Run Code Online (Sandbox Code Playgroud)