Exclude an environment configuration from rake execution?

On my rails project I have config/environments/development.rb with the
following configuration:

config.after_initialize do
puts ‘=> Abc Loader Initialized’
AbcLoader.do_something
end

I need this here so it can be executed on the startup of the
application.

However, everytime I execute a rake task on the application, this code
is also executed. Is there a way to exclude this code from rake tasks?