forked from easonjim/5_java_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...1/src/main/java/com/jsoft/springboottest/springboottest1/controller/IndexController2.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.jsoft.springboottest.springboottest1.controller; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
import com.ctrip.framework.apollo.Config; | ||
import com.ctrip.framework.apollo.ConfigChangeListener; | ||
import com.ctrip.framework.apollo.ConfigService; | ||
import com.ctrip.framework.apollo.model.ConfigChange; | ||
import com.ctrip.framework.apollo.model.ConfigChangeEvent; | ||
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig; | ||
|
||
@Controller | ||
public class IndexController2 { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(IndexController2.class); | ||
|
||
private Config config = ConfigService.getAppConfig(); | ||
|
||
@RequestMapping(value = "/index2", method = RequestMethod.GET) | ||
public String index(Model model) { | ||
Entry entry = new Entry(); | ||
entry.setText("Text"); | ||
entry.setTitle("Title"); | ||
model.addAttribute("entries", entry); | ||
model.addAttribute("entry", new Entry()); | ||
|
||
model.addAttribute("url", config.getProperty("url", "")); | ||
model.addAttribute("timeout",config.getProperty("timeout", "")); | ||
model.addAttribute("batch",config.getProperty("batch", "")); | ||
|
||
logger.info("timeout:{}", config.getProperty("timeout", "")); | ||
logger.info("batch:{}", config.getProperty("batch", "")); | ||
logger.info("url:{}", config.getProperty("url", "")); | ||
|
||
return "index"; | ||
} | ||
|
||
} |