package com.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.core.env.Environment; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import org.springframework.web.servlet.i18n.SessionLocaleResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; import java.util.Locale; import java.util.Properties; @Configuration @EnableWebMvc @ComponentScan(basePackages = {"com"}) @EnableTransactionManagement @EnableJpaRepositories(basePackages = {"com"}) @PropertySource("classpath:application.properties") public class MVConfig extends WebMvcConfigurerAdapter { @Bean public ViewResolver viewResolver (){ InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver(); internalResourceViewResolver.setViewClass(JstlView.class); internalResourceViewResolver.setPrefix("/WEB-INF/jsp/"); internalResourceViewResolver.setSuffix(".jsp"); return internalResourceViewResolver; } @Autowired @Bean LocaleChangeInterceptor localeChangeInterceptor() { LocaleChangeInterceptor localeChangeInterceptor= new LocaleChangeInterceptor(); localeChangeInterceptor.setParamName("language"); return localeChangeInterceptor; } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(localeChangeInterceptor()); } @Bean SessionLocaleResolver localeResolver() { SessionLocaleResolver localeResolver = new SessionLocaleResolver() ; return localeResolver; } @Bean ResourceBundleMessageSource messageSource(){ ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); messageSource.setBasename("tableData"); return messageSource; } @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(hibernateProperties()); return em; } @Bean public DataSource dataSource(){ DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost:3306/orange"); dataSource.setUsername( "root" ); dataSource.setPassword( "root" ); return dataSource; } { properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect")); properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql")); properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql")); properties.put("hibernate.hbm2ddl.auto", "create"); properties.put("hibernate.enable_lazy_load_no_trans","true"); return properties; } @Bean @Autowired public PlatformTransactionManager transactionManager(EntityManagerFactory emf){ JpaTransactionManager transactionManager = new JpaTransactionManager(); transactionManager.setEntityManagerFactory(emf); return transactionManager; } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } }
Standard input is empty
Main.java:40: error: class MVConfig is public, should be declared in a file named MVConfig.java
public class MVConfig extends WebMvcConfigurerAdapter {
^
Main.java:3: error: package org.springframework.beans.factory.annotation does not exist
import org.springframework.beans.factory.annotation.Autowired;
^
Main.java:4: error: package org.springframework.context.annotation does not exist
import org.springframework.context.annotation.Bean;
^
Main.java:5: error: package org.springframework.context.annotation does not exist
import org.springframework.context.annotation.ComponentScan;
^
Main.java:6: error: package org.springframework.context.annotation does not exist
import org.springframework.context.annotation.Configuration;
^
Main.java:7: error: package org.springframework.context.annotation does not exist
import org.springframework.context.annotation.PropertySource;
^
Main.java:8: error: package org.springframework.context.support does not exist
import org.springframework.context.support.ResourceBundleMessageSource;
^
Main.java:9: error: package org.springframework.core.env does not exist
import org.springframework.core.env.Environment;
^
Main.java:10: error: package org.springframework.data.jpa.repository.config does not exist
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
^
Main.java:11: error: package org.springframework.jdbc.datasource does not exist
import org.springframework.jdbc.datasource.DriverManagerDataSource;
^
Main.java:12: error: package org.springframework.orm.jpa does not exist
import org.springframework.orm.jpa.JpaTransactionManager;
^
Main.java:13: error: package org.springframework.orm.jpa does not exist
import org.springframework.orm.jpa.JpaVendorAdapter;
^
Main.java:14: error: package org.springframework.orm.jpa does not exist
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
^
Main.java:15: error: package org.springframework.orm.jpa.vendor does not exist
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
^
Main.java:16: error: package org.springframework.transaction does not exist
import org.springframework.transaction.PlatformTransactionManager;
^
Main.java:17: error: package org.springframework.transaction.annotation does not exist
import org.springframework.transaction.annotation.EnableTransactionManagement;
^
Main.java:18: error: package org.springframework.web.servlet does not exist
import org.springframework.web.servlet.ViewResolver;
^
Main.java:19: error: package org.springframework.web.servlet.config.annotation does not exist
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
^
Main.java:20: error: package org.springframework.web.servlet.config.annotation does not exist
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
^
Main.java:21: error: package org.springframework.web.servlet.config.annotation does not exist
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
^
Main.java:22: error: package org.springframework.web.servlet.config.annotation does not exist
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
^
Main.java:23: error: package org.springframework.web.servlet.i18n does not exist
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
^
Main.java:24: error: package org.springframework.web.servlet.i18n does not exist
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
^
Main.java:25: error: package org.springframework.web.servlet.view does not exist
import org.springframework.web.servlet.view.InternalResourceViewResolver;
^
Main.java:26: error: package org.springframework.web.servlet.view does not exist
import org.springframework.web.servlet.view.JstlView;
^
Main.java:28: error: package javax.persistence does not exist
import javax.persistence.EntityManagerFactory;
^
Main.java:40: error: cannot find symbol
public class MVConfig extends WebMvcConfigurerAdapter {
^
symbol: class WebMvcConfigurerAdapter
Main.java:33: error: cannot find symbol
@Configuration
^
symbol: class Configuration
Main.java:34: error: cannot find symbol
@EnableWebMvc
^
symbol: class EnableWebMvc
Main.java:35: error: cannot find symbol
@ComponentScan(basePackages = {"com"})
^
symbol: class ComponentScan
Main.java:36: error: cannot find symbol
@EnableTransactionManagement
^
symbol: class EnableTransactionManagement
Main.java:37: error: cannot find symbol
@EnableJpaRepositories(basePackages = {"com"})
^
symbol: class EnableJpaRepositories
Main.java:38: error: cannot find symbol
@PropertySource("classpath:application.properties")
^
symbol: class PropertySource
Main.java:42: error: cannot find symbol
public ViewResolver viewResolver (){
^
symbol: class ViewResolver
location: class MVConfig
Main.java:50: error: cannot find symbol
private Environment environment;
^
symbol: class Environment
location: class MVConfig
Main.java:53: error: cannot find symbol
LocaleChangeInterceptor localeChangeInterceptor()
^
symbol: class LocaleChangeInterceptor
location: class MVConfig
Main.java:61: error: cannot find symbol
public void addInterceptors(InterceptorRegistry registry) {
^
symbol: class InterceptorRegistry
location: class MVConfig
Main.java:67: error: cannot find symbol
SessionLocaleResolver localeResolver()
^
symbol: class SessionLocaleResolver
location: class MVConfig
Main.java:75: error: cannot find symbol
ResourceBundleMessageSource messageSource(){
^
symbol: class ResourceBundleMessageSource
location: class MVConfig
Main.java:82: error: cannot find symbol
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
^
symbol: class LocalContainerEntityManagerFactoryBean
location: class MVConfig
Main.java:115: error: cannot find symbol
public PlatformTransactionManager transactionManager(EntityManagerFactory emf){
^
symbol: class EntityManagerFactory
location: class MVConfig
Main.java:115: error: cannot find symbol
public PlatformTransactionManager transactionManager(EntityManagerFactory emf){
^
symbol: class PlatformTransactionManager
location: class MVConfig
Main.java:121: error: cannot find symbol
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
^
symbol: class DefaultServletHandlerConfigurer
location: class MVConfig
Main.java:41: error: cannot find symbol
@Bean
^
symbol: class Bean
location: class MVConfig
Main.java:49: error: cannot find symbol
@Autowired
^
symbol: class Autowired
location: class MVConfig
Main.java:52: error: cannot find symbol
@Bean
^
symbol: class Bean
location: class MVConfig
Main.java:66: error: cannot find symbol
@Bean
^
symbol: class Bean
location: class MVConfig
Main.java:74: error: cannot find symbol
@Bean
^
symbol: class Bean
location: class MVConfig
Main.java:81: error: cannot find symbol
@Bean
^
symbol: class Bean
location: class MVConfig
Main.java:93: error: cannot find symbol
@Bean
^
symbol: class Bean
location: class MVConfig
Main.java:113: error: cannot find symbol
@Bean
^
symbol: class Bean
location: class MVConfig
Main.java:114: error: cannot find symbol
@Autowired
^
symbol: class Autowired
location: class MVConfig
Main.java:43: error: cannot find symbol
InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver();
^
symbol: class InternalResourceViewResolver
location: class MVConfig
Main.java:43: error: cannot find symbol
InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver();
^
symbol: class InternalResourceViewResolver
location: class MVConfig
Main.java:44: error: cannot find symbol
internalResourceViewResolver.setViewClass(JstlView.class);
^
symbol: class JstlView
location: class MVConfig
Main.java:55: error: cannot find symbol
LocaleChangeInterceptor localeChangeInterceptor= new LocaleChangeInterceptor();
^
symbol: class LocaleChangeInterceptor
location: class MVConfig
Main.java:55: error: cannot find symbol
LocaleChangeInterceptor localeChangeInterceptor= new LocaleChangeInterceptor();
^
symbol: class LocaleChangeInterceptor
location: class MVConfig
Main.java:60: error: method does not override or implement a method from a supertype
@Override
^
Main.java:69: error: cannot find symbol
SessionLocaleResolver localeResolver = new SessionLocaleResolver() ;
^
symbol: class SessionLocaleResolver
location: class MVConfig
Main.java:69: error: cannot find symbol
SessionLocaleResolver localeResolver = new SessionLocaleResolver() ;
^
symbol: class SessionLocaleResolver
location: class MVConfig
Main.java:76: error: cannot find symbol
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
^
symbol: class ResourceBundleMessageSource
location: class MVConfig
Main.java:76: error: cannot find symbol
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
^
symbol: class ResourceBundleMessageSource
location: class MVConfig
Main.java:83: error: cannot find symbol
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
^
symbol: class LocalContainerEntityManagerFactoryBean
location: class MVConfig
Main.java:83: error: cannot find symbol
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
^
symbol: class LocalContainerEntityManagerFactoryBean
location: class MVConfig
Main.java:87: error: cannot find symbol
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
^
symbol: class JpaVendorAdapter
location: class MVConfig
Main.java:87: error: cannot find symbol
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
^
symbol: class HibernateJpaVendorAdapter
location: class MVConfig
Main.java:95: error: cannot find symbol
DriverManagerDataSource dataSource = new DriverManagerDataSource();
^
symbol: class DriverManagerDataSource
location: class MVConfig
Main.java:95: error: cannot find symbol
DriverManagerDataSource dataSource = new DriverManagerDataSource();
^
symbol: class DriverManagerDataSource
location: class MVConfig
Main.java:116: error: cannot find symbol
JpaTransactionManager transactionManager = new JpaTransactionManager();
^
symbol: class JpaTransactionManager
location: class MVConfig
Main.java:116: error: cannot find symbol
JpaTransactionManager transactionManager = new JpaTransactionManager();
^
symbol: class JpaTransactionManager
location: class MVConfig
Main.java:120: error: method does not override or implement a method from a supertype
@Override
^
71 errors
Standard output is empty