在该html文件中,有一个图像:
<div class="login-branding">
<a href="index.html"><img src="../static/images/logo.png" alt="Clevex" title="Clevex"></a>
</div>
Run Code Online (Sandbox Code Playgroud)
在http://localhost:8090/login地址,我查看控制台并看到:
但是当申请完成时,如果我去
http://localhost:8090/images/logo.png
这个网址,我可以在浏览器控制台看到图像,没有任何错误或警告chrome。
这是我的安全配置:
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private CustomAuthenticationProvider customAuthenticationProvider;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable();
String[] resources = new String[]{
"/",
"/home",
"/pictureCheckCode",
"/include/**",
"/css/**",
"/icons/**",
"/images/**",
"/js/**",
"/resources/**",
"/layer/**",
"/static/**",
"/js/**",
"/img/**",
"/webjars/**"
};
http
.authorizeRequests()
.antMatchers(resources).permitAll()
Run Code Online (Sandbox Code Playgroud)
我也添加了@EnableAutoConfiguration,但它没有做任何事情。并且也给出了错误。
我不想使用addResourceHandlers因为它是 spring boot 并且它应该进行自动配置。
目录是这样的:
src
-main
-resources
--static
---images …Run Code Online (Sandbox Code Playgroud) 我想在服务层抛出异常:
List<String> cellValuesOfTheRow = getColumnValuesForRow(row, false);
logger.info("currentRowNumber: {}, cellValuesOfTheRow: {}", currentRowNumber, cellValuesOfTheRow);
if (cellValuesOfTheRow.contains(null)) {
throw new NullFieldValueException(currentRowNumber);
}
Run Code Online (Sandbox Code Playgroud)
如果该列表包含空值,我希望它抛出异常。
我做了一个自定义例外:
public class NullFieldValueException extends RuntimeException {
private static final long serialVersionUID = -8460356990632230194L;
int currentRowNumber;
public NullFieldValueException(int currentRowNumber) {
super();
this.currentRowNumber = currentRowNumber;
}
}
Run Code Online (Sandbox Code Playgroud)
我也有控制器建议:
List<String> cellValuesOfTheRow = getColumnValuesForRow(row, false);
logger.info("currentRowNumber: {}, cellValuesOfTheRow: {}", currentRowNumber, cellValuesOfTheRow);
if (cellValuesOfTheRow.contains(null)) {
throw new NullFieldValueException(currentRowNumber);
}
Run Code Online (Sandbox Code Playgroud)
这是来自messages/messages_en.properties:
#nullpointer
error.null.field.value=Empty or null value for the row number: {0} …Run Code Online (Sandbox Code Playgroud)