Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Controller
- public class MainController
- {
- @Autowired
- private ApplicationContextProvider mObjApplicationContextProvider;
- @Autowired
- private ScheduleService mObjScheduleService;
- protected ApplicationContext getApplicationContext()
- {
- return(getApplicationContextProvider().getApplicationContext());
- }
- protected ApplicationContextProvider getApplicationContextProvider()
- {
- return(mObjApplicationContextProvider);
- }
- protected Object getBean(final Class<?> clsBean)
- {
- return(getApplicationContext().getBean(clsBean));
- }
- protected Object getBean(final String sBeanName)
- {
- return(getApplicationContext().getBean(sBeanName));
- }
- protected ScheduleService getScheduleService()
- {
- return(mObjScheduleService);
- }
- @RequestMapping(value="/")
- public String index()
- {
- return("index");
- }
- }
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Insert title here</title>
- </head>
- <body>
- Hello World!
- </body>
- </html>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
- <context:component-scan base-package="net.draconia.church" />
- <bean class="net.draconia.ApplicationContextProvider" />
- <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
- <property name="driverClassName" value="com.mysql.cj.jdbc.Driver" />
- <property name="url" value="jdbc:mysql:sql9.freemysqlhosting.net/sql9158326" />
- <property name="username" value="sql9158326" />
- <property name="password" value="MqX7sbacgB" />
- </bean>
- <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
- <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
- <property name="prefix" value="/WEB-INF/views/jsp/" />
- <property name="suffix" value=".jsp" />
- </bean>
- <mvc:resources mapping="/resources/**" location="/resources/" />
- <mvc:annotation-driven />
- </beans>
- public String index()
- {
- return("index");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement