This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<servlet> | |
<servlet-name>dispatcher</servlet-name> | |
<servlet-class> | |
org.springframework.web.servlet.DispatcherServlet | |
</servlet-class> | |
<init-param> | |
<param-name>spring.profiles.active</param-name> | |
<param-value>dev</param-value> | |
</init-param> | |
<init-param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.driver=org.postgresql.Driver | |
db.url=jdbc:postgresql://localhost:5432/spring5fs | |
db.user=charlie | |
db.password=charlie123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package config; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; | |
import org.springframework.core.io.ClassPathResource; | |
@Configuration | |
public class PropertyConfig { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package config; | |
import org.apache.tomcat.jdbc.pool.DataSource; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
@Configuration | |
public class DsConfigWithProp { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spring; | |
import org.springframework.beans.factory.annotation.Value; | |
public class Info { | |
@Value("${info.version}") | |
private String version; | |
public String getVersion() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package spring; | |
import org.springframework.beans.factory.annotation.Value; | |
public class Info { | |
private String version; | |
public String getVersion() { | |
return version; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebMvcpublic class MvcConfig implements WebMvcConfigurer { | |
@Override | |
public void configureDefaultServletHandling(final DefaultServletHandlerConfigurer configurer) { | |
configurer.enable(); | |
} | |
@Override | |
public void configureViewResolvers(final ViewResolverRegistry registry) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableWebMvcpublic | |
class MvcConfig implements WebMvcConfigurer { | |
... | |
@Override | |
public void configureViewResolvers(final ViewResolverRegistry registry) { | |
registry.jsp("/WEB-INF/view/", ".jsp"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 위의 설정은 내부적으로 아래와 같은 설정으로 빈을 등록 | |
@Bean | |
public ViewResolver viewResolver() { | |
InternalResourceViewResolver vr = new InternalResourceViewResolver(); | |
vr.setPrefix("/WEB-INF/view"); | |
vr.setSuffix(".jsp"); | |
return vr; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
@RequestMapping("/register") | |
public class RegistController { | |
@RequestMapping("/step1") | |
public String handleStep1() { | |
... | |
} | |
@RequestMapping("/step2") |