Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.whattodo;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.ComponentScan;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.jdbc.datasource.DriverManagerDataSource;
- import org.springframework.web.servlet.config.annotation.EnableWebMvc;
- import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
- import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
- import javax.sql.DataSource;
- /**
- * Created by knalum on 8/22/16.
- */
- @Configuration
- @ComponentScan(basePackages = "com.whattodo")
- @EnableWebMvc
- public class MvcConfiguration extends WebMvcConfigurerAdapter{
- @Bean
- public DataSource getDataSource(){
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
- dataSource.setDriverClassName("com.mysql.jdbc.Driver");
- dataSource.setUsername("jdbc:mysql://localhost:3306/item");
- dataSource.setUsername("client");
- dataSource.setUsername("client");
- return dataSource;
- }
- @Bean
- public ItemDaoInterface getItemDao(){
- return new ItemDao(getDataSource());
- }
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement