我有一个使用 Maven 构建的 Spring-MVC 的 web 应用程序。当我生成 JAR 文件时,应用程序启动得很好。控制器正在执行,但是当我到达这一部分时:
@RequestMapping(value = "/test-block", method = RequestMethod.GET)
public ModelAndView block(Model model) {
return new ModelAndView("templates/test-block");
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
There was an unexpected error (type=Not Found, status=404).
/WEB-INF/templates/test-block.jsp
Run Code Online (Sandbox Code Playgroud)
请注意,在 IDE 中调试或运行可以正常工作。
我的文件夹:
src
|--main
|--java
|--com.xxx // sources
webapp
|--WEB-INF
|--templates
|--*.jsp // jsp files
resources
|--application.properties
Run Code Online (Sandbox Code Playgroud)
我的应用程序属性:
spring.mvc.view.prefix=/WEB-INF/
spring.mvc.view.suffix=.jsp
Run Code Online (Sandbox Code Playgroud)
我检查了生成的 JAR 文件,但在任何地方都看不到 WEB-INF。
编辑:
pom文件:
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud) 我想看看Java和Spring的注释的内部工作原理@Controller,@RequestMapping("/")以及如何映射到内部,所以我想看看Spring的注释处理器的实现。
@Override对于其他 Java 注释处理器也是如此。
有没有办法在Delphi 7中获取数组/分隔字符串中类/对象的给定方法的参数名称?不知何故这样:
var
s : string;
aSL : TStringList;
begin
...
// using rtti calls in TMethodUtility.collectParamNames
s := TMethodUtility.collectParamNames( TStringList.addObject );
// or
TMethodUtility.collectParamNames( TStringList.addObject, aSL );
...
end;
Run Code Online (Sandbox Code Playgroud)
提前致谢!
在Delphi XE4中是否有类似Java的Map?如果是的话,欢迎一些解释.我想将命令提示符params转换为映射以通过键访问它们(通过预期的param名称).
绑定到Delphi XE4编译器的条件编译器指令是什么?我虽然这样:
{$ifdef VerDXE4}
code segment compiled only by the Delphi XE4 compiler
{$endif}
Run Code Online (Sandbox Code Playgroud) CapsLock无意中按下时非常烦人,我意识到我输入的文本是相反的情况.是否有任何热键可以反转Delphi 10.2编辑器中所选文本的大小写?也许对于其他情况(上层,下层,资本,骆驼,uncapitalCamel).
MartynA回答了这个问题,我必须意识到映射到这个函数(Ctrl-O U)的热键不是一个微不足道的.所以我想到的另一个问题是:有没有办法自定义热键映射?正如我所看到的"选项"对话框不可用.(或者我找不到它)
我在Delphi 6编写的教程中读到:要安装ADOX组件,请从主菜单Project\Add type Library菜单项中选择.但是在Delphi XE4中没有这样的菜单项.如何在Delphi XE4中安装/使用ADOX组件以编程方式创建一个空的mdb数据库?或者有没有其他方法可以在没有ADOX的情况下创建它?
在Delphi XE4中的每个方法调用之后,我应该检查什么选项来禁用汇编代码跟踪?
如果跟踪(F7)TMyClass.foo的调用,则结果集将导致程序集跟踪.
type
TMyClass = class
public
function foo : string;
end;
function TMyClass.foo : string;
begin
result := 'x';
end;
Run Code Online (Sandbox Code Playgroud) 我想为我的UserController课程写一个JUnit测试(Java单元),但是我不知道该怎么做。
UserController:
@RestController
@RequestMapping(CompositeController.ENTRY)
public class UserController {
protected final static String ENTRY = "/demo/v1/composite";
private UserService userService;
@Autowired
public UserController(UserService userService) {
this.userService = userService;
}
@GetMapping(path = "/isadmin")
public ResponseEntity<Boolean> checkadmin(@RequestHeader String nickname){
return userService.checkifadmin(nickname);
}
Run Code Online (Sandbox Code Playgroud)
UserService:
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@Service
public interface UserService {
ResponseEntity<Boolean> checkifadmin(String nickname);
}
Run Code Online (Sandbox Code Playgroud)
UserServiceImpl:
public class UserServiceImpl implements UserService {
private final String userBaseAdress = "http://localhost:7777";
private final String userBasePath = "/demo/v1/user";
public ResponseEntity<Boolean> checkifadmin(String nickname) {
HttpHeaders headers …Run Code Online (Sandbox Code Playgroud) TDictionary<string,T>由于某种原因,我想在周围使用包装纸。但是,当我尝试通过for编译器遍历地图时,会说:
[dcc32 Error] Unit1.pas(23): E2010 Incompatible types: 'T' and 'System.Generics.Collections.TPair<System.string,Unit1.TMyMapWrapper<T>.T>'
如何修改通用类型声明以使像这样的简单代码可编译?
这是我的简化代码:
unit Unit1;
interface
implementation
uses
Generics.Collections
;
type
TMyMapWrapper<T> = class
private
fMap : TDictionary<string,T>;
public
procedure foo;
end;
procedure TMyMapWrapper<T>.foo;
var
item : T;
begin
for item in fMap do
;
end;
end.
Run Code Online (Sandbox Code Playgroud) delphi ×7
java ×3
spring-mvc ×3
delphi-xe4 ×2
spring-boot ×2
adox ×1
assembly ×1
database ×1
debugging ×1
generics ×1
junit ×1
junit4 ×1
maven ×1
parameters ×1
rtti ×1
spring ×1