1

I have a @ConfigurationProperties class, like ConfigProperty. I use it like

org.springframework.ui.Model#addAttribute("config1", configProperty.config1) org.springframework.ui.Model#addAttribute("config2", configProperty.config2)

I don't want repeat myself. So I want to it like this:

Model#addAttribute(::configProperty.config1.name, configProperty.config1) Model#addAttribute(::configProperty.config2.name, configProperty.config2)

But the syntax is wrong, anyone has some suggestions?

Cnfn
  • 1,123
  • 8
  • 11

1 Answers1

0

After this question, I find that the syntax is wrong. I should use it like:

Model#addAttribute(ConfigProperty::config1.name, configProperty.config1) 
Model#addAttribute(ConfigProperty::config2.name, configProperty.config2)

Thanks for everybody~

Cnfn
  • 1,123
  • 8
  • 11