Pessoal tudo bem ?
Nao esta o projeto nao esta fazendo o carregamento do bootstrap, estou acompanhando a aula e fazendo o passo a passo, mas nao carrega. Dando o seguinte erro: ↓
GET http://localhost:8080/casadocodigo/resources/css/bootstrap-theme.min.css net::ERR_ABORTED
GET http://localhost:8080/casadocodigo/resources/css/bootstrap.min.css net::ERR_ABORTED
GET http://localhost:8080/casadocodigo/resources/js/bootstrap.min.js net::ERR_ABORTED
public class AppWebConfiguration extends WebMvcConfigurerAdapter {
@Bean
public InternalResourceViewResolver internalResourceViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");// para que o projeto veja os prefixos
resolver.setSuffix(".jsp");// paginas que serao acessadas
resolver.setExposedContextBeanNames("carrinhoCompras"); // metodo que expoe um item para o bean ficar exposto
return resolver;
}
/**
* Metodo que carregara nossas mensagens de retorno.
*
* @return messageSource
*/
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
// local onde sera encontrado o caminho do arquivo messages.properties
messageSource.setBasename("/WEB-INF/messages");
// tipo de enconding.
messageSource.setDefaultEncoding("UTF-8");
// tempo que podemos salvar o arquivo sem necessariamente ter que subir
// novamente o servidor.
messageSource.setCacheSeconds(1);
return messageSource;
}
/**
* Conversor de datas do Spring
*
* @return
*/
@Bean
public FormattingConversionService mvcConversionService() {
DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();
DateFormatterRegistrar formatterRegistrar = new DateFormatterRegistrar();
formatterRegistrar.setFormatter(new DateFormatter("dd/MM/yyyy"));
formatterRegistrar.registerFormatters(conversionService);
return conversionService;
}
/**
* Metodo que mostra para o spring trabalhar com arquivos.
*
* @return
*/
@Bean
public MultipartResolver multipartResolver() {
return new StandardServletMultipartResolver();
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/css", "/resources/imagens","resources/js");
}
// template que buscara as informacoes em rest
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
// gerente de cache
/**
* Maximum Size, quantos itens esta sendo usado no cache, tempo para expirar
* sera em 5 minutos
*
* @return
*/
@Bean
public CacheManager cacheManager() {
CacheBuilder<Object, Object> builder = CacheBuilder.newBuilder().maximumSize(100).expireAfterAccess(5,
TimeUnit.MINUTES);
GuavaCacheManager manager = new GuavaCacheManager();
manager.setCacheBuilder(builder);
return new ConcurrentMapCacheManager();
}
/**
* Metodo que ira identificar se a requisicao vai ser em jsp ou rest.
*
* @param manager
* @return
*/
@Bean
public ViewResolver contetNegotiationViewResolver(ContentNegotiationManager manager) {
List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>();
viewResolvers.add(internalResourceViewResolver());
viewResolvers.add(new JsonViewResolver());
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
resolver.setViewResolvers(viewResolvers);
// metodo que ira verificar o que sera retornado
resolver.setContentNegotiationManager(manager);
return resolver;
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
}
Caso eu retire o comentario do metodo addResourceHandlers, o erro é este: ↓
Failed to load resource: the server responded with a status of 404 () - bootstrap.min.js
Failed to load resource: the server responded with a status of 404 () - bootstrap-theme.min.css
Failed to load resource: the server responded with a status of 404 ()
bootstrap.min.css
Meus arquivos estao no caminho, scr/main/webapp/resources....