Apesar de estar com todas as URLS configuradas, com tudo certinho (em teoria), ao acessar a página pelo link http://localhost:8080/casadocodigo/ ou http://localhost:8080/casadocodigo_test/ recebo o erro 404, já tentei vários meios de acessar o link porém sempre recebo o mesmo retorno.
alguns códigos que configuram o acesso podem ser encontrados nesse estado (em caso de dúvida para o auxílio):
@Bean
public InternalResourceViewResolver internalResourceViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
// resolver.setExposeContextBeansAsAttributes(true);
resolver.setExposedContextBeanNames("carrinhoCompras");
return resolver;
}
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("/WEB-INF/messages");
messageSource.setDefaultEncoding("UTF-8");
messageSource.setCacheSeconds(1);
return messageSource;
}
Para o teste:
public class DataSourceConfigurationTest {
@Bean
@Profile("test")
public DataSource dataSource(){
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setUsername("desenv");
dataSource.setPassword("minha_senha");
dataSource.setUrl("jdbc:sqlserver://localhost:8080/casadocodigo_test");
dataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
return (DataSource) dataSource;
}
}
JPA Config:
public class JPAConfiguration {
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
factoryBean.setJpaVendorAdapter(vendorAdapter);
factoryBean.setDataSource(DriverManagerDataSource(factoryBean));
Properties properties = additionalProprieties();
factoryBean.setJpaProperties(properties);
factoryBean.setPackagesToScan("br.com.casadocodigo.loja.models");
return factoryBean;
}
private Properties additionalProprieties() {
Properties properties = new Properties();
properties.setProperty("hibernate.dialect",
"org.hibernate.dialect.SQLServerDialect");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.hbm2ddl.auto", "update");
return properties;
}
@Profile("dev")
private DataSource DriverManagerDataSource(
LocalContainerEntityManagerFactoryBean factoryBean) {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setUsername("desenv");
dataSource.setPassword("minha_senha");
dataSource.setUrl(
"jdbc:sqlserver://(Ip e porta aqui);databaseName=DES_PROESTAGIARIO_20181115");
dataSource.setDriverClassName(
"com.microsoft.sqlserver.jdbc.SQLServerDriver");
return dataSource;
}
@Bean
public JpaTransactionManager transactionManager(EntityManagerFactory emf) {
return new JpaTransactionManager(emf);
}
}
Obs: em geral a mesma config do que a do curso, o que muda basicamente é minha connection com o DB (q é no SQL)